[FIX] web: load_translation fallback to url language
This commit is fine tuning of 9f142c8ff5a383. Apparently, context_get callback is never called. I guess this is due to the fact that we are higher. context_get is defined in public/public_root.js and we are in core/session.js The only way to fix is to retrieve the HTML tag language. OPW-2244843 closes odoo/odoo#53155 X-original-commit: 2bbb8fbf7ae909da03d97d16b228ae5a95de7d18 Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
This commit is contained in:
@@ -211,15 +211,13 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
|
||||
});
|
||||
},
|
||||
load_translations: function () {
|
||||
var lang = this.user_context.lang;
|
||||
|
||||
if (!lang) {
|
||||
this.trigger_up('context_get', {
|
||||
callback: function (ctx) {
|
||||
lang = ctx.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;
|
||||
|
||||
return _t.database.load_translations(this, this.module_list, lang, this.translationURL);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user