Skip to content

Commit 76c18b5

Browse files
committed
optimize: move i18n to lib
1 parent 8364750 commit 76c18b5

File tree

14 files changed

+4
-4
lines changed

14 files changed

+4
-4
lines changed

.github/workflows/genlocale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Run locale generation
1515
run: |
1616
python3 extract_locale.py
17-
cd i18n && python3 locale_diff.py
17+
cd lib/i18n && python3 locale_diff.py
1818
1919
- name: Commit back
2020
if: ${{ !github.head_ref }}

extract_locale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ def process(fn: str):
2929
process("gui_v1.py")
3030

3131
# Save as a JSON file
32-
with open("./i18n/zh_CN.json", "w", encoding="utf-8") as f:
32+
with open("./lib/i18n/zh_CN.json", "w", encoding="utf-8") as f:
3333
json.dump(data, f, ensure_ascii=False, indent=4)
3434
f.write("\n")

i18n.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
def load_language_list(language):
7-
with open(f"./i18n/{language}.json", "r", encoding="utf-8") as f:
7+
with open(f"./lib/i18n/{language}.json", "r", encoding="utf-8") as f:
88
language_list = json.load(f)
99
return language_list
1010

@@ -15,7 +15,7 @@ def __init__(self, language=None):
1515
language = locale.getdefaultlocale()[
1616
0
1717
] # getlocale can't identify the system's language ((None, None))
18-
if not os.path.exists(f"./i18n/{language}.json"):
18+
if not os.path.exists(f"./lib/i18n/{language}.json"):
1919
language = "en_US"
2020
self.language = language
2121
# print("Use Language:", language)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)