Merge pull request #1454 from Max1Truc/fix-bad-locale

Fix "KeyError: 'fr'" in desktop strings.py
This commit is contained in:
Saptak Sengupta 2021-11-14 19:05:14 +05:30 committed by GitHub
commit 182b6bb67b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,7 +43,11 @@ def load_strings(common, locale_dir):
current_locale = common.settings.get("locale") current_locale = common.settings.get("locale")
strings = {} strings = {}
for s in translations[default_locale]: for s in translations[default_locale]:
if s in translations[current_locale] and translations[current_locale][s] != "": if (
current_locale in translations
and s in translations[current_locale]
and translations[current_locale][s] != ""
):
strings[s] = translations[current_locale][s] strings[s] = translations[current_locale][s]
else: else:
strings[s] = translations[default_locale][s] strings[s] = translations[default_locale][s]