From 1576f3ea76329f4897411698016b09843e7d323a Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 22 Apr 2021 14:03:09 +0200 Subject: locale selection --- talermerchantdemos/donations/donations.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'talermerchantdemos/donations/donations.py') diff --git a/talermerchantdemos/donations/donations.py b/talermerchantdemos/donations/donations.py index 903952c..fa2b077 100644 --- a/talermerchantdemos/donations/donations.py +++ b/talermerchantdemos/donations/donations.py @@ -64,6 +64,7 @@ BABEL_TRANSLATION_DIRECTORIES = "../translations" app.config.from_object(__name__) babel = Babel(app) +babel.localeselector(get_locale) LOGGER.info("Using translations from:" + ":".join(list(babel.translation_directories))) @@ -74,21 +75,6 @@ LOGGER.info( "Operating with the following translations available: " + " ".join(translations) ) -app.add_template_global(self_localized) - - -@babel.localeselector -def get_locale(): - parts = request.path.split("/", 2) - if 2 >= len(parts): - # Totally unexpected path format, do not localize - return "en" - lang = parts[1] - if lang in translations: - return lang - return "en" - - # Add context processor that will make additional variables # and functions available in the template. app.context_processor(make_utility_processor("donations")) -- cgit v1.2.3