From 15a86d0f841a7b5254ac8c14260c5a08f5d272c7 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Thu, 9 May 2024 19:30:06 +1200 Subject: [PATCH] default to 'en' in celery #51 --- app/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 3aaf86ec..2862426a 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -20,13 +20,16 @@ from config import Config def get_locale(): - if session.get('ui_language', None): - return session['ui_language'] - else: - try: - return request.accept_languages.best_match(current_app.config['LANGUAGES']) - except: - return 'en' + try: + if session.get('ui_language', None): + return session['ui_language'] + else: + try: + return request.accept_languages.best_match(current_app.config['LANGUAGES']) + except: + return 'en' + except: + return 'en' db = SQLAlchemy() # engine_options={'pool_size': 5, 'max_overflow': 10} # session_options={"autoflush": False}