trying to translate without loading the translation file will now return the text key instead of raising an error

This commit is contained in:
Faraphel 2022-08-20 10:30:16 +02:00
parent fb8d20c08f
commit 970f18f503

View file

@ -26,7 +26,7 @@ def translate(*text) -> str:
:return: translated text
"""
return "".join([
self._language_data["translation"].get(word, word) if isinstance(word, str)
self._language_data.get("translation", {}).get(word, word) if isinstance(word, str)
else str(word)
for word in text
])