aboutsummaryrefslogtreecommitdiff
path: root/budget/run.py
diff options
context:
space:
mode:
Diffstat (limited to 'budget/run.py')
-rw-r--r--budget/run.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/budget/run.py b/budget/run.py
index ebcf45e..3d57329 100644
--- a/budget/run.py
+++ b/budget/run.py
@@ -24,7 +24,9 @@ babel = Babel(app)
@babel.localeselector
def get_locale():
- lang = request.accept_languages.best_match(['fr', 'en'])
+ # get the lang from the session if defined, fallback on the browser "accept
+ # languages" header.
+ lang = session.get('lang', request.accept_languages.best_match(['fr', 'en']))
setattr(g, 'lang', lang)
return lang