optimize: move i18n to lib

This commit is contained in:
源文雨 2023-07-24 14:19:53 +08:00
parent 8364750272
commit 76c18b547c
14 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ jobs:
- name: Run locale generation
run: |
python3 extract_locale.py
cd i18n && python3 locale_diff.py
cd lib/i18n && python3 locale_diff.py
- name: Commit back
if: ${{ !github.head_ref }}

View File

@ -29,6 +29,6 @@ print("processing gui_v1.py")
process("gui_v1.py")
# Save as a JSON file
with open("./i18n/zh_CN.json", "w", encoding="utf-8") as f:
with open("./lib/i18n/zh_CN.json", "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=4)
f.write("\n")

View File

@ -4,7 +4,7 @@ import os
def load_language_list(language):
with open(f"./i18n/{language}.json", "r", encoding="utf-8") as f:
with open(f"./lib/i18n/{language}.json", "r", encoding="utf-8") as f:
language_list = json.load(f)
return language_list
@ -15,7 +15,7 @@ class I18nAuto:
language = locale.getdefaultlocale()[
0
] # getlocale can't identify the system's language ((None, None))
if not os.path.exists(f"./i18n/{language}.json"):
if not os.path.exists(f"./lib/i18n/{language}.json"):
language = "en_US"
self.language = language
# print("Use Language:", language)