commit 6142f74ab16efe7dabab9b4b731ccb4983260b80
parent 1e093c9bd7a238ee1e01a27d253b2ebe98bd8a4a
Author: Bohdan Potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Sun, 6 Jul 2025 15:50:15 +0200
update for the language selection logic
Diffstat:
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/talermerchantdemos/landing/landing.py b/talermerchantdemos/landing/landing.py
@@ -136,7 +136,30 @@ def start(lang):
# get_locale defaults to english, hence the
# condition below happens only when lang is
# wrong or unsupported, respond 404.
- if lang != get_locale():
+ # This one, seems like to check for
+ # -H "Accept-Language: fr"
+ # so for the case of en browser and fr/ it can fail...
+ #if lang != get_locale():
+ # raise werkzeug.exceptions.NotFound()
+ # I think we can check for the translations array
+ translations = [
+ "ar", # Arabic
+ "de", # German
+ "en", # English
+ "es", # Spanish
+ "fr", # French
+ "hi", # Hindi
+ "it", # Italian
+ "ja", # Japanese
+ "ko", # Korean
+ "pt", # Portuguese
+ "ru", # Russian
+ "sv", # Swedish
+ "tr", # Turkish
+ "uk", # Ukrainian
+ "zh_Hant" # Chinese (Traditional)
+ ]
+ if lang not in translations:
raise werkzeug.exceptions.NotFound()
if x := os.environ.get("TALER_ENV_URL_BANK"):