From db7e1496b0af8f6270b8304055f2aabb2428fbe0 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Mon, 17 Oct 2011 00:03:41 +0200 Subject: Add the ability to change the language explicitely. I'm not sure the UI is better with this. Any thoughts are welcome. Fix #35 --- budget/run.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'budget/run.py') 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 -- cgit v1.1