From fb7c9719aea4189382741bc262f8d535d68c2fe1 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Sat, 29 Oct 2022 12:38:48 +0200 Subject: [builder][server][proxy] make translations.py mypy-compliant --- src/hydrilla/translations.py | 7 +++++-- 1 file 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] = {} -- cgit v1.2.3