From 9b6ca49b582e63c6be446f164d318115f47b29d5 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 4 Apr 2018 16:19:25 +0200 Subject: [PATCH] =?UTF-8?q?[FIX]=20http:=20Bokm=C3=A5l=20language=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Install Website - Load the 'Norwegian Bokmål' translation, and choose to translate the website - Logout When accessing the website, the language displayed is not consistent to the browser language. 1. `no` shows homepage in `nb_NO` (Firefox only) => expected since Bokmål is the main language in Norway 2. `nb` shows homepage in `en_US` => unexpected 3. `nn` shows homepage in `en_US` => expected since 'Norwegian Nynorsk' is not a language available (this will be the topic of another PR) The issues comes from Babel's side, since `nb` is not in the `LOCALE_ALIASES` while `no` is. We monkey-patch the value to avoid this while Babel is corrected. opw-1827258 --- odoo/http.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/odoo/http.py b/odoo/http.py index 15ef0bfd6bb..83505d2c36b 100644 --- a/odoo/http.py +++ b/odoo/http.py @@ -58,6 +58,9 @@ rpc_response = logging.getLogger(__name__ + '.rpc.response') # 1 week cache for statics as advised by Google Page Speed STATIC_CACHE = 60 * 60 * 24 * 7 +# To remove when corrected in Babel +babel.core.LOCALE_ALIASES['nb'] = 'nb_NO' + #---------------------------------------------------------- # RequestHandler #----------------------------------------------------------