From 970f18f5037616d5ea542318eb14ceda34698e13 Mon Sep 17 00:00:00 2001 From: Faraphel Date: Sat, 20 Aug 2022 10:30:16 +0200 Subject: [PATCH] trying to translate without loading the translation file will now return the text key instead of raising an error --- source/translation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/translation.py b/source/translation.py index a82213b..f279fa0 100644 --- a/source/translation.py +++ b/source/translation.py @@ -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 ])