aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-29 12:38:48 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-29 12:38:48 +0200
commitfb7c9719aea4189382741bc262f8d535d68c2fe1 (patch)
treeb35c6ca102cb1ac30780cd4bf2039aae57bf1d48 /src
parent2ac064cd07c0126c7b71fe1150a77a3ab7cea651 (diff)
downloadhaketilo-hydrilla-fb7c9719aea4189382741bc262f8d535d68c2fe1.tar.gz
haketilo-hydrilla-fb7c9719aea4189382741bc262f8d535d68c2fe1.zip
[builder][server][proxy] make translations.py mypy-compliant
Diffstat (limited to 'src')
-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] = {}