if key doesnt exist in en.json and is used as a fallback return missing key
This commit is contained in:
parent
365c60be31
commit
6ff4e49dfb
2 changed files with 5 additions and 1 deletions
3
main.py
3
main.py
|
@ -130,6 +130,9 @@ def get_translation(lang: str, key: str):
|
|||
lang_translations = translations.get(lang, {})
|
||||
if key in lang_translations:
|
||||
return lang_translations[key]
|
||||
else:
|
||||
if key not in translations.get("en", {}):
|
||||
return f"[VOLTA] {RED}Missing key: '{key}' in en.json!{RESET}"
|
||||
fallback = translations.get("en", {}).get(key, key)
|
||||
print(f"[VOLTA] {RED}Missing key: '{key}' in language '{lang}', falling back to: '{fallback}'{RESET}") # yeah probably print this
|
||||
return fallback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue