summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/session.js
diff options
context:
space:
mode:
authorjvm-odoo <jvm@odoo.com>2020-06-17 07:48:21 +0000
committerjvm-odoo <jvm@odoo.com>2020-06-17 11:32:01 +0000
commit93479ad005bd69b269a662003e70163d0f405e05 (patch)
tree5e32c08a7aebb524466f14e2902dcc767b12ed44 /addons/web/static/src/js/core/session.js
parent546709dab6a7d4fd6fb90a6b92c4788e3d3c135d (diff)
[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>
Diffstat (limited to 'addons/web/static/src/js/core/session.js')
-rw-r--r--addons/web/static/src/js/core/session.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/addons/web/static/src/js/core/session.js b/addons/web/static/src/js/core/session.js
index 354cca6d6f8..ae31b95696d 100644
--- a/addons/web/static/src/js/core/session.js
+++ b/addons/web/static/src/js/core/session.js
@@ -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);
},