aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/translations.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla/translations.py')
-rw-r--r--src/hydrilla/translations.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/hydrilla/translations.py b/src/hydrilla/translations.py
index 1ff8788..f6e6760 100644
--- a/src/hydrilla/translations.py
+++ b/src/hydrilla/translations.py
@@ -39,7 +39,7 @@ supported_locales = [f.name for f in localedir.iterdir() if f.is_dir()]
default_locale = 'en_US'
-def select_best_locale(supported: t.Iterable[str] = supported_locales) -> str:
+def select_best_locale(supported: t.Sequence[str] = supported_locales) -> str:
"""
....
@@ -72,7 +72,10 @@ def select_best_locale(supported: t.Iterable[str] = supported_locales) -> str:
except:
pass
- return locale if locale in supported else default_locale
+ if locale is None or locale not in supported:
+ locale = default_locale
+
+ return locale
translations: t.Dict[str, gettext.NullTranslations] = {}