aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/translations.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-28 20:15:30 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-28 20:15:30 +0200
commit43ed7392cdfc734a4304284906b9d0d503381841 (patch)
tree5d78662357507aac0820825a8ace0859c395779d /src/hydrilla/translations.py
parent2a622842c38f1f9df2aee6af28bf9932d05a2ef0 (diff)
downloadhaketilo-hydrilla-43ed7392cdfc734a4304284906b9d0d503381841.tar.gz
haketilo-hydrilla-43ed7392cdfc734a4304284906b9d0d503381841.zip
[proxy] make it possible to export embedded documentation as standalone .html files and include these in the binary release tarball
Diffstat (limited to 'src/hydrilla/translations.py')
-rw-r--r--src/hydrilla/translations.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hydrilla/translations.py b/src/hydrilla/translations.py
index 62c8c88..1ff8788 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() -> str:
+def select_best_locale(supported: t.Iterable[str] = supported_locales) -> str:
"""
....
@@ -56,8 +56,8 @@ def select_best_locale() -> str:
if use_flask:
best = flask.request.accept_languages.best_match(
- supported_locales,
- default=default_locale
+ supported,
+ default = default_locale
)
assert best is not None
return best
@@ -72,7 +72,7 @@ def select_best_locale() -> str:
except:
pass
- return locale if locale in supported_locales else default_locale
+ return locale if locale in supported else default_locale
translations: t.Dict[str, gettext.NullTranslations] = {}