Skip to content

Commit 71bf6a4

Browse files
authored
feat: link zh_TW.json to zh_HK.json & zh_SG.json (#64)
* optimize: 精简未用到的配置项并在特征提取初步引入mps * add cmd argument: --noautoopen * fix: i18n * fix * fix * add genlocale workflow * add unitest * fix * fix * fix * 优化笔记本 * reintroduce Push changes * disable genlocale on non-main branch * 将笔记本checkout改为stable * 优化代码结构 * make lint happy * make lint happy * 优化 * 优化 * 优化 * fix path on windows okey pack * fix * fix * revert * revert * revert * fix: extract locale regex * feat: link zh_TW.json to zh_HK.json & zh_SG.json * fix #50: set default language to en_US
1 parent 7ee8b20 commit 71bf6a4

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

locale/locale_diff.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
standard_file = "zh_CN.json"
66

77
# Define the list of supported languages
8+
# zh_HK.json and zh_SG.json is not included in the list
9+
# because they are symbolinks to zh_TW.json
810
languages = ["zh_TW.json", "ja_JP.json", "en_US.json"]
911

1012
# Load the standard file

locale/zh_HK.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zh_TW.json

locale/zh_SG.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zh_TW.json

webui_locale.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import locale
22
import json
3+
import os
34

45

56
def load_language_list(language):
@@ -14,6 +15,8 @@ def __init__(self, language=None):
1415
language = "auto"
1516
if language == "auto":
1617
language = locale.getdefaultlocale()[0]
18+
if not os.path.exists(f"./locale/{language}.json"):
19+
language = "en_US"
1720
self.language = language
1821
print("Use Language:", language)
1922
self.language_map = load_language_list(language)

0 commit comments

Comments
 (0)