Fix language fallback logic in _get_lang function

Previously, _get_lang returned 'EN' if the language was not found, which could cause issues. Now, it sets lang to 'EN' and continues processing, ensuring consistent behavior.
This commit is contained in:
Choco
2025-09-25 23:13:07 +08:00
parent 2c98dfd763
commit 44b4ba68d1

View File

@@ -169,7 +169,7 @@ def format_bytes(bytes: int, unit: bool = False):
def _get_lang(lang: str, *keys) -> Optional[Union[list[str], str]]:
if lang not in LANGS:
return "EN"
lang = "EN"
if not LANGS[lang]:
LANGS[lang] = open_json(os.path.join("langs", f"{lang}.json"))