From a760e2fabcfd8e149fed3542fb16051f18e8cac4 Mon Sep 17 00:00:00 2001 From: Samuel ORTION Date: Thu, 26 May 2022 14:59:28 +0200 Subject: [PATCH] Fix translation --- app.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 5d55524..8545252 100644 --- a/app.py +++ b/app.py @@ -22,18 +22,14 @@ app.config['SQLALCHEMY_DATABASE_URI'] = database_uri app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['BABEL_DEFAULT_LOCALE'] = 'en' - +app.config['BABEL_TRANSLATION_DIRECTORIES'] = "./language/translations" babel = Babel(app) db.init_app(app) @babel.localeselector def get_locale(): - # if a user is logged in, use the locale from the user settings - user = getattr(g, 'user', None) - if user is not None: - return user.locale - elif session['lang']: + if not session.get('lang') is None: return session['lang'] # otherwise try to guess the language from the user accept # header the browser transmits. We support fr/en in this