Update i18n.py (#117)

This commit is contained in:
Ftps 2023-04-22 01:35:37 +09:00 committed by GitHub
parent c941512427
commit ebc0b227c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -11,10 +11,8 @@ def load_language_list(language):
class I18nAuto:
def __init__(self, language=None):
if language is None:
language = "auto"
if language == "auto":
language = locale.getdefaultlocale()[0]
if language in ['auto', None]:
language = locale.getlocale()[0]
if not os.path.exists(f"./i18n/{language}.json"):
language = "en_US"
self.language = language