From 6b06ada2c2a0ea5a8a008baedf512271d397e954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Wed, 29 Jul 2020 13:11:50 +0000 Subject: [PATCH] [FIX] mail: fix messaging locale update on translation bundle change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes odoo/odoo#55167 X-original-commit: c3eb3f04e06cea84dd98323b6d10867dead5b953 Signed-off-by: Sébastien Theys (seb) Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/js/core/translation.js | 27 +++++++++++++++++++ addons/mail/views/assets.xml | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 addons/mail/static/src/js/core/translation.js 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; + }, +}); + +}); diff --git a/addons/mail/views/assets.xml b/addons/mail/views/assets.xml index 7a6447651be..4b1877277e0 100644 --- a/addons/mail/views/assets.xml +++ b/addons/mail/views/assets.xml @@ -9,6 +9,8 @@