[FIX] web: do not use default en_US lang when loading translations from session
When loading translations from Session, if no lang is defined in context or html, it is loading translations of en_US lang by default. No default should be used to fallback on the language of the current user. opw-2501708 closes odoo/odoo#69336 X-original-commit: 0b9ab4efcf66d4c5099a9f33d2fb1b4dd814eb5c Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
This commit is contained in:
@@ -195,13 +195,16 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
||||
});
|
||||
},
|
||||
load_translations: function (modules=null) {
|
||||
var lang = this.user_context.lang
|
||||
/* We need to get the website lang at this level.
|
||||
The only way is to get it is to take the HTML tag lang
|
||||
Without it, we will always send undefined if there is no lang
|
||||
in the user_context. */
|
||||
var html = document.documentElement,
|
||||
htmlLang = (html.getAttribute('lang') || 'en_US').replace('-', '_'),
|
||||
lang = this.user_context.lang || htmlLang;
|
||||
htmlLang = html.getAttribute('lang');
|
||||
if (!this.user_context.lang && htmlLang) {
|
||||
lang = htmlLang.replace('-', '_');
|
||||
}
|
||||
|
||||
return _t.database.load_translations(this, modules, lang, this.translationURL);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user