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