🐛 修复获取系统语言代码的逻辑,添加对None值的处理

This commit is contained in:
远野千束 2024-11-29 00:01:49 +08:00
parent b0761e9873
commit 86f47ee411

View File

@ -213,7 +213,11 @@ def get_system_lang_code() -> str:
"""
获取系统语言代码
"""
return locale.getdefaultlocale()[0].replace("_", "-")
l = locale.getdefaultlocale()
if l[0] is None:
return "zh-CN"
else:
return l[0].replace("_", "-")
def get_default_lang_code() -> str: