This commit is contained in:
2025-04-17 12:50:51 +08:00
parent 5acf94f36d
commit cf0d047c39
8457 changed files with 558153 additions and 566117 deletions

View File

@ -183,6 +183,7 @@ def import_translation(
shutil.rmtree("import_tmp")
WEBLATE_PATH = "/home/ws3917/Code/Weblate"
if __name__ == "__main__":
# 备份文件
translation_key_mtext = [
@ -235,23 +236,24 @@ if __name__ == "__main__":
initialize_translation_json(
"text/en_US", ["Text", "Array"], "strings/dialogue.json"
)
os.system(f"cd {WEBLATE_PATH} && git pull")
update_translation_json(
"translation-tools/weblate/dialogue/en.json",
f"{WEBLATE_PATH}/drhps/dialogue/en.json",
"strings/dialogue.json",
"translation-tools/weblate/dialogue/zh_CN.json",
f"{WEBLATE_PATH}/drhps/dialogue/zh_CN.json",
"strings/dialogue-zh_CN.json",
)
update_translation_json(
"translation-tools/weblate/mtext/en.json",
f"{WEBLATE_PATH}/drhps/mtext/en.json",
"strings/mtext.json",
"translation-tools/weblate/mtext/zh_CN.json",
f"{WEBLATE_PATH}/drhps/mtext/zh_CN.json",
"strings/mtext-zh_CN.json",
)
copy_dict_str = {
"strings/dialogue.json": "translation-tools/weblate/dialogue/en.json",
"strings/mtext.json": "translation-tools/weblate/mtext/en.json",
"strings/dialogue-zh_CN.json": "translation-tools/weblate/dialogue/zh_CN.json",
"strings/mtext-zh_CN.json": "translation-tools/weblate/mtext/zh_CN.json",
"strings/dialogue.json": f"{WEBLATE_PATH}/drhps/dialogue/en.json",
"strings/mtext.json": f"{WEBLATE_PATH}/drhps/mtext/en.json",
"strings/dialogue-zh_CN.json": f"{WEBLATE_PATH}/drhps/dialogue/zh_CN.json",
"strings/mtext-zh_CN.json": f"{WEBLATE_PATH}/drhps/mtext/zh_CN.json",
}
for src, dst in copy_dict_str.items():
os.system(f"cp -r {src} {dst}")
@ -260,15 +262,15 @@ if __name__ == "__main__":
"text/en_US",
"text/zh_CN",
["Text", "Array"],
"translation-tools/weblate/dialogue/en.json",
"translation-tools/weblate/dialogue/zh_CN.json",
f"{WEBLATE_PATH}/drhps/dialogue/en.json",
f"{WEBLATE_PATH}/drhps/dialogue/zh_CN.json",
)
import_translation(
"text/zh_CN",
"text/zh_CN",
translation_key_mtext,
"translation-tools/weblate/mtext/en.json",
"translation-tools/weblate/mtext/zh_CN.json",
f"{WEBLATE_PATH}/drhps/mtext/en.json",
f"{WEBLATE_PATH}/drhps/mtext/zh_CN.json",
)
convert_zh_to_tw("text/zh_CN", ".json")