if key doesnt exist in en.json and is used as a fallback return missing key

This commit is contained in:
WhatDidYouExpect 2025-07-07 12:24:08 +02:00
parent 365c60be31
commit 6ff4e49dfb
2 changed files with 5 additions and 1 deletions

View file

@ -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