summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/core
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/mail/static/src/js/core
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/mail/static/src/js/core')
-rw-r--r--addons/mail/static/src/js/core/translation.js28
1 files changed, 28 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 00000000..faecafaf
--- /dev/null
+++ b/addons/mail/static/src/js/core/translation.js
@@ -0,0 +1,28 @@
+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 values have to be
+ // updated by the received ones.
+ Component.env.messaging.locale.update({
+ language: this.parameters.code,
+ textDirection: this.parameters.direction,
+ });
+ }
+ return res;
+ },
+});
+
+});