From e71fe9820acc0d21865f9ee7318b2a5e71f7749f Mon Sep 17 00:00:00 2001 From: Petar Najman Date: Thu, 23 Feb 2023 10:37:47 +0000 Subject: [PATCH] [FIX] web: Locale not loaded for Serbian lang In Serbia there are two language codes and those are `sr_RS` (Cyrillic) and `sr@latin` (Latin). Inside of the `web/static/lib/moment/locale` folder, the two langs are registered as `sr-cyrl.js` and `sr.js` respectively. The `load_locale` controller wasn't loading the right langs for neither case. X-original-commit: 65d5ab801f22b42a0f94fe4b86f68ace451ea184 Part-of: odoo/odoo#114565 --- addons/web/controllers/webclient.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/web/controllers/webclient.py b/addons/web/controllers/webclient.py index 6a88cc9a122..e6d8783393f 100644 --- a/addons/web/controllers/webclient.py +++ b/addons/web/controllers/webclient.py @@ -29,10 +29,17 @@ def CONTENT_MAXAGE(): return http.STATIC_CACHE_LONG +MOMENTJS_LANG_CODES_MAP = { + "sr_RS": "sr_cyrl", + "sr@latin": "sr" +} + + class WebClient(http.Controller): @http.route('/web/webclient/locale/', type='http', auth="none") def load_locale(self, lang): + lang = MOMENTJS_LANG_CODES_MAP.get(lang, lang) magic_file_finding = [lang.replace("_", '-').lower(), lang.split('_')[0]] for code in magic_file_finding: try: