Skip to content

Commit 65d5ab8

Browse files
[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. Part-of: odoo#113490
1 parent cfd7189 commit 65d5ab8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

addons/web/controllers/webclient.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,17 @@ def CONTENT_MAXAGE():
2929
return http.STATIC_CACHE_LONG
3030

3131

32+
MOMENTJS_LANG_CODES_MAP = {
33+
"sr_RS": "sr_cyrl",
34+
"sr@latin": "sr"
35+
}
36+
37+
3238
class WebClient(http.Controller):
3339

3440
@http.route('/web/webclient/locale/<string:lang>', type='http', auth="none")
3541
def load_locale(self, lang):
42+
lang = MOMENTJS_LANG_CODES_MAP.get(lang, lang)
3643
magic_file_finding = [lang.replace("_", '-').lower(), lang.split('_')[0]]
3744
for code in magic_file_finding:
3845
try:

0 commit comments

Comments
 (0)