summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-07-29 13:11:50 +0000
committerSébastien Theys <seb@odoo.com>2020-07-29 15:41:10 +0000
commit6b06ada2c2a0ea5a8a008baedf512271d397e954 (patch)
tree0c035e99194a29cd84430bc7802f12207065470c /addons/mail/static/src/js
parenta28f24ca3f9a431f74bc24ba7d5df4087c8d78c9 (diff)
[FIX] mail: fix messaging locale update on translation bundle change
closes odoo/odoo#55167 X-original-commit: c3eb3f04e06cea84dd98323b6d10867dead5b953 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com> Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/js')
-rw-r--r--addons/mail/static/src/js/core/translation.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/core/translation.js b/addons/mail/static/src/js/core/translation.js
new file mode 100644
index 00000000000..a8db8cebc57
--- /dev/null
+++ b/addons/mail/static/src/js/core/translation.js
@@ -0,0 +1,27 @@
+odoo.define('mail/static/src/js/core/translation.js', function (require) {
+'use strict';
+
+const { TranslationDataBase } = require('web.translation');
+
+const { Component } = owl;
+
+TranslationDataBase.include({
+ /**
+ * @override
+ */
+ set_bundle() {
+ const res = this._super(...arguments);
+ if (Component.env.messaging) {
+ // Update messaging locale whenever the translation bundle changes.
+ // In particular if messaging is created before the end of the
+ // `load_translations` RPC, the default text direction has to be
+ // updated by the received one.
+ Component.env.messaging.locale.update({
+ textDirection: this.parameters.direction,
+ });
+ }
+ return res;
+ },
+});
+
+});