aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-10-28 12:03:32 +0200
committerWojtek Kosior <koszko@koszko.org>2022-10-28 12:03:32 +0200
commitedb1299c7196a6c3909f4ec3160428636197d877 (patch)
tree6a8d1cd42701d890f22bf781d254c9f04a244bcc /src/hydrilla/proxy/web_ui
parentfddbbf96bf447bfb630e4a0fd67f6ba7c8c0e141 (diff)
downloadhaketilo-hydrilla-edb1299c7196a6c3909f4ec3160428636197d877.tar.gz
haketilo-hydrilla-edb1299c7196a6c3909f4ec3160428636197d877.zip
[proxy] don't use gettext for localization of doc pages; add a stub of "packages" doc page
Diffstat (limited to 'src/hydrilla/proxy/web_ui')
-rw-r--r--src/hydrilla/proxy/web_ui/root.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/hydrilla/proxy/web_ui/root.py b/src/hydrilla/proxy/web_ui/root.py
index 917c063..4eea860 100644
--- a/src/hydrilla/proxy/web_ui/root.py
+++ b/src/hydrilla/proxy/web_ui/root.py
@@ -45,7 +45,7 @@ import jinja2
import flask
import werkzeug
-from ...translations import translation as make_translation
+from ... import translations
from ... import versions
from ... import item_infos
from ... import common_jinja_templates
@@ -188,8 +188,14 @@ def home_doc(page: str) -> str:
if page not in self_doc.page_names:
flask.abort(404)
+ locale = translations.select_best_locale()
+ if locale == translations.default_locale:
+ prefix = ''
+ else:
+ prefix = f'{locale}/'
+
return flask.render_template(
- f'{page}.html.jinja',
+ f'{prefix}{page}.html.jinja',
doc_output = 'html_hkt_mitm_it'
)
@@ -239,7 +245,8 @@ def process_request(
with app._haketilo_app_lock:
app._haketilo_state = state
- app.jinja_env.install_gettext_translations(make_translation())
+ best_translations = translations.translation()
+ app.jinja_env.install_gettext_translations(best_translations)
flask_response = app.test_client().open(
path = path,