Skip to content

Commit

Permalink
Merge pull request #118 from VoltIcaRus/master
Browse files Browse the repository at this point in the history
Korean, teen version  and add support for KR ONE Client
  • Loading branch information
pur1fying authored Jul 19, 2024
2 parents b57f0c4 + a50a3c2 commit 21caf68
Show file tree
Hide file tree
Showing 24 changed files with 2,324 additions and 42 deletions.
2 changes: 1 addition & 1 deletion core/Baas_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def init_server(self):
server = self.config['server']
if server == '官服' or server == 'B服':
self.server = 'CN'
elif server == '国际服':
elif server == '国际服' or server == '国际服青少年' or server == '韩国ONE':
self.server = 'Global'
elif server == '日服':
self.server = 'JP'
Expand Down
5 changes: 5 additions & 0 deletions core/default_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,12 +657,17 @@
"官服": "com.RoamingStar.BlueArchive",
"B服": "com.RoamingStar.BlueArchive.bilibili",
"国际服": "com.nexon.bluearchive",
"国际服青少年": "com.nexon.bluearchiveteen",
"韩国ONE": "com.nexon.bluearchiveone",
"日服": "com.YostarJP.BlueArchive"
},
"activity_name": {
"官服": "com.yostar.sdk.bridge.YoStarUnityPlayerActivity",
"B服": "com.yostar.sdk.bridge.YoStarUnityPlayerActivity",
"国际服": ".MxUnityPlayerActivity",
"国际服青少年": ".MxUnityPlayerActivity",
"韩国ONE": ".MxUnityPlayerActivity",
"日服": "com.yostarjp.bluearchive.MxUnityPlayerActivity"
},
"total_assault_difficulties": {
Expand Down
40 changes: 21 additions & 19 deletions develop_tools/auto_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ def handle(self, request):


class Request:
def __init__(self, handlers: list[Handler],
qt_language: Language,
translator: str = 'bing',
from_lang: str = 'auto',
def __init__(self, handlers: list[Handler],
qt_language: Language,
translator: str = 'bing',
from_lang: str = 'auto',
to_lang: str = 'en'):
"""
Parameters
----------
handlers: list[Handler]
a list of handlers that represent the files to translate.
a list of handlers that represent the files to translate.
qt_language: Language
the memeber of the enum Language to translate
Expand All @@ -44,18 +44,18 @@ def __init__(self, handlers: list[Handler],
self.qt_language = qt_language
self.strLang = qt_language.value.name()
self.handlers = handlers
self.translator = translator
self.translator = translator
self.from_lang = from_lang
self.to_lang = to_lang

def translate_text(self, text):
text = ts.translate_text(text, self.translator, self.from_lang, self.to_lang)
print(text)
return text

def translate_html(self, html_text):
return ts.translate_html(html_text, self.translator, self.from_lang, self.to_lang)

def process(self):
self.handlers[0].handle(self)

Expand All @@ -65,14 +65,14 @@ def handle(self, request):
result = subprocess.run(['pylupdate5', 'i18n.pro'], capture_output=True, text=True)
print(result.stdout)
self.set_next(request)


class XmlHandler(Handler):
"""Translate ts files"""
def handle(self, request):
# Load the XML from a file
input_file = os.path.join('../gui/i18n/', f'{request.strLang}.ts')
output_file = os.path.join('../gui/i18n/', f'{request.strLang}.ts')
input_file = os.path.join('gui/i18n/', f'{request.strLang}.ts')
output_file = os.path.join('gui/i18n/', f'{request.strLang}.ts')

tree = etree.parse(input_file)
root = tree.getroot()
Expand Down Expand Up @@ -123,7 +123,7 @@ def translate_mission_types(self, request, input_dir, output_dir):
f.write(text)

def handle(self, request):
input_dir = '../src/descriptions/'
input_dir = 'src/descriptions/zh_CN/'
output_dir = f'src/descriptions/{request.strLang}'
# Ensure the output directory exists
if not os.path.exists(output_dir):
Expand All @@ -142,7 +142,7 @@ def handle(self, request):
translated_html = request.translate_html(html)
soup = BeautifulSoup(translated_html, 'lxml')
prettyHTML = soup.prettify()

# Write the translated HTML to the output directory
name, extension = os.path.splitext(filename)
output_name = f'{request.translate_text(name)}.html'
Expand All @@ -152,7 +152,7 @@ def handle(self, request):

class LreleaseHandler(Handler):
def handle(self, request):
directory = os.path.join(os.getcwd(), '../gui', 'i18n')
directory = os.path.join(os.getcwd(), 'gui', 'i18n')
result = subprocess.run(['lrelease', f'{request.strLang}.ts'], cwd=directory, capture_output=True, text=True)
print(result.stdout)
self.set_next(request)
Expand All @@ -164,12 +164,14 @@ def handle(self, request):
descriptions = HtmlHandler()
lrelease = LreleaseHandler()

# request_en = Request([pylupdate, gui, descriptions, lrelease], Language.ENGLISH, 'bing', 'zh-Hans', 'en')
# request_en.process()

# request_ko = Request([pylupdate, gui, descriptions, lrelease], Language.KOREAN, 'google', 'zh-Hans', 'ko')
# request_ko.process()
request_en = Request([pylupdate, gui, lrelease], Language.ENGLISH, 'bing', 'zh-Hans', 'en')
request_en.process()

request_jp = Request([gui], Language.JAPANESE, 'bing', 'zh-Hans', 'ja')
request_jp.process()
request_ja = Request([pylupdate, gui, lrelease], Language.JAPANESE, 'bing', 'zh-Hans', 'ja')
request_ja.process()

request_ko = Request([pylupdate, gui, lrelease], Language.KOREAN, 'bing', 'zh-Hans', 'ko')
request_ko.process()

2 changes: 1 addition & 1 deletion gui/components/expand/serverConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, parent=None, config=None):
'label': ServerConfig.tr('请选择您的服务器,请慎重切换服务器,切换服务器后请重新启动脚本'),
'type': 'combo',
'key': 'server',
'selection': [ServerConfig.tr('官服'), ServerConfig.tr('B服'), ServerConfig.tr('国际服'), ServerConfig.tr('日服')]
'selection': [ServerConfig.tr('官服'), ServerConfig.tr('B服'), ServerConfig.tr('国际服'), ServerConfig.tr('国际服青少年'), ServerConfig.tr('韩国ONE'), ServerConfig.tr('日服')]
},
{
'label': ServerConfig.tr('请填写您的adb端口号'),
Expand Down
Binary file modified gui/i18n/en_US.qm
Binary file not shown.
46 changes: 33 additions & 13 deletions gui/i18n/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ make sure to do it before starting the script.</translation>
<translation>Global</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="103"/>
<location filename="../util/config_translation.py" line="105"/>
<source>日服</source>
<translation>JP</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="106"/>
<location filename="../util/config_translation.py" line="108"/>
<source>拖动礼物</source>
<translation>Drag the gift</translation>
</message>
Expand Down Expand Up @@ -255,27 +255,27 @@ make sure to do it before starting the script.</translation>
<message>
<location filename="../util/config_translation.py" line="86"/>
<source>静子神明文字x5</source>
<translation>Shizuko&apos;s Eleph</translation>
<translation>Shizuko's Eleph</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="87"/>
<source>真白神明文字x5</source>
<translation>Mashiro&apos;s Eleph</translation>
<translation>Mashiro's Eleph</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="88"/>
<source>纱绫神明文字x5</source>
<translation>Saya&apos;s Eleph</translation>
<translation>Saya's Eleph</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="89"/>
<source>风香神明文字x5</source>
<translation>Fuuka&apos;s Eleph</translation>
<translation>Fuuka's Eleph</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="90"/>
<source>歌原神明文字x5</source>
<translation>Utaha&apos;s Eleph</translation>
<translation>Utaha's Eleph</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="91"/>
Expand Down Expand Up @@ -318,17 +318,17 @@ make sure to do it before starting the script.</translation>
<translation>No Task</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="109"/>
<location filename="../util/config_translation.py" line="111"/>
<source>MuMu模拟器</source>
<translation>MuMu Player</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="110"/>
<location filename="../util/config_translation.py" line="112"/>
<source>蓝叠模拟器</source>
<translation>BlueStacks CN</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="111"/>
<location filename="../util/config_translation.py" line="113"/>
<source>蓝叠国际版</source>
<translation>BlueStacks</translation>
</message>
Expand All @@ -342,6 +342,16 @@ make sure to do it before starting the script.</translation>
<source>咖啡厅邀请</source>
<translation>Cafe Invitation</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="103"/>
<source>国际服青少年</source>
<translation>Global Teen</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="104"/>
<source>韩国ONE</source>
<translation>KR Onestore</translation>
</message>
</context>
<context>
<name>DetailSettingMessageBox</name>
Expand Down Expand Up @@ -396,7 +406,7 @@ make sure to do it before starting the script.</translation>
<message>
<location filename="../components/expand/emulatorConfig.py" line="17"/>
<source>在运行Baas时打开模拟器(启动模拟器的功能开关,关闭后不会启动模拟器)</source>
<translation>&lt;b&gt;Open the emulator on running Baas&lt;/b&gt; &lt;br/&gt;(The switch for start emulator. Emulator won&apos;t be started if closed)</translation>
<translation>&lt;b&gt;Open the emulator on running Baas&lt;/b&gt; &lt;br/&gt;(The switch for start emulator. Emulator won't be started if closed)</translation>
</message>
<message>
<location filename="../components/expand/emulatorConfig.py" line="27"/>
Expand Down Expand Up @@ -715,7 +725,7 @@ See Clear Hard and Normal Stages in Help</translation>
<location filename="../components/expand/mainlinePriority.py" line="23"/>
<source>困难关卡设置同上,注意:次数最多为3),逗号均为英文逗号,日服、国际服可填max:</source>
<translation>Set hard stages as above, with a maximum of 3 sweeps. Use commas for separation.
For JP or Global server, you can use &apos;max&apos;:</translation>
For JP or Global server, you can use 'max':</translation>
</message>
<message>
<location filename="../components/expand/mainlinePriority.py" line="114"/>
Expand Down Expand Up @@ -1118,6 +1128,16 @@ For JP or Global server, you can use &apos;max&apos;:</translation>
<source>检测adb地址(检测目前开启的模拟器adb地址)</source>
<translation>Detect the adb address of the currently opened emulator</translation>
</message>
<message>
<location filename="../components/expand/serverConfig.py" line="24"/>
<source>国际服青少年</source>
<translation>Global Teen</translation>
</message>
<message>
<location filename="../components/expand/serverConfig.py" line="24"/>
<source>韩国ONE</source>
<translation type="unfinished">KR Onestore</translation>
</message>
</context>
<context>
<name>SettingsFragment</name>
Expand Down Expand Up @@ -1149,7 +1169,7 @@ For JP or Global server, you can use &apos;max&apos;:</translation>
<message>
<location filename="../fragments/settings.py" line="37"/>
<source>选择你的服务器平台,设置你的端口(不知道端口请设置为0)</source>
<translation>Select your server platform and set your port (set to 0 if you don&apos;t know the port)</translation>
<translation>Select your server platform and set your port (set to 0 if you don't know the port)</translation>
</message>
<message>
<location filename="../fragments/settings.py" line="45"/>
Expand Down
Binary file modified gui/i18n/ja_JP.qm
Binary file not shown.
30 changes: 25 additions & 5 deletions gui/i18n/ja_JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,30 +317,40 @@
<translation>国際サーバー</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="103"/>
<location filename="../util/config_translation.py" line="105"/>
<source>日服</source>
<translation>日本サーバー</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="106"/>
<location filename="../util/config_translation.py" line="108"/>
<source>拖动礼物</source>
<translation>ギフトドラッグ</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="109"/>
<location filename="../util/config_translation.py" line="111"/>
<source>MuMu模拟器</source>
<translation>MuMuエミュレータ</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="110"/>
<location filename="../util/config_translation.py" line="112"/>
<source>蓝叠模拟器</source>
<translation>Blue Stack「中国」シミュレータ</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="111"/>
<location filename="../util/config_translation.py" line="113"/>
<source>蓝叠国际版</source>
<translation>Blue Stack「国際」シミュレータ</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="103"/>
<source>国际服青少年</source>
<translation type="unfinished">国際奉仕の十代の若者たち</translation>
</message>
<message>
<location filename="../util/config_translation.py" line="104"/>
<source>韩国ONE</source>
<translation type="unfinished">KR Onestore</translation>
</message>
</context>
<context>
<name>DetailSettingMessageBox</name>
Expand Down Expand Up @@ -1106,6 +1116,16 @@
<source>检测adb地址(检测目前开启的模拟器adb地址)</source>
<translation>ADB アドレスの検出 (現在有効なエミュレータの ADB アドレスを確認してください)</translation>
</message>
<message>
<location filename="../components/expand/serverConfig.py" line="24"/>
<source>国际服青少年</source>
<translation type="unfinished">国際奉仕の十代の若者たち</translation>
</message>
<message>
<location filename="../components/expand/serverConfig.py" line="24"/>
<source>韩国ONE</source>
<translation>KR Onestore</translation>
</message>
</context>
<context>
<name>SettingsFragment</name>
Expand Down
Binary file added gui/i18n/ko_KR.qm
Binary file not shown.
Loading

0 comments on commit 21caf68

Please sign in to comment.