Spaces:
Sleeping
Sleeping
xingfanxia
commited on
Commit
•
ef976df
1
Parent(s):
c2cbaab
add `default_ui_lang` env (#679)
Browse files* add default ui lang env
* refactor
* add i18n env
- modules/config.py +2 -1
- modules/webui_locale.py +2 -1
modules/config.py
CHANGED
@@ -32,7 +32,8 @@ if os.path.exists("config.json"):
|
|
32 |
else:
|
33 |
config = {}
|
34 |
|
35 |
-
|
|
|
36 |
|
37 |
if os.path.exists("api_key.txt"):
|
38 |
logging.info("检测到api_key.txt文件,正在进行迁移...")
|
|
|
32 |
else:
|
33 |
config = {}
|
34 |
|
35 |
+
lang_config = config.get("language", "auto")
|
36 |
+
language = os.environ.get("default_ui_lang", lang_config)
|
37 |
|
38 |
if os.path.exists("api_key.txt"):
|
39 |
logging.info("检测到api_key.txt文件,正在进行迁移...")
|
modules/webui_locale.py
CHANGED
@@ -9,7 +9,8 @@ class I18nAuto:
|
|
9 |
config = json.load(f)
|
10 |
else:
|
11 |
config = {}
|
12 |
-
|
|
|
13 |
if language == "auto":
|
14 |
language = locale.getdefaultlocale()[0] # get the language code of the system (ex. zh_CN)
|
15 |
self.language_map = {}
|
|
|
9 |
config = json.load(f)
|
10 |
else:
|
11 |
config = {}
|
12 |
+
lang_config = config.get("language", "auto")
|
13 |
+
language = os.environ.get("default_ui_lang", lang_config)
|
14 |
if language == "auto":
|
15 |
language = locale.getdefaultlocale()[0] # get the language code of the system (ex. zh_CN)
|
16 |
self.language_map = {}
|