diff options
| -rw-r--r-- | addons/mail/static/src/js/core/translation.js | 27 | ||||
| -rw-r--r-- | addons/mail/views/assets.xml | 2 |
2 files changed, 29 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; + }, +}); + +}); 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 @@ <template id="assets_backend" name="mail assets" inherit_id="web.assets_backend"> <xpath expr="." position="inside"> + <script type="text/javascript" src="/mail/static/src/js/core/translation.js"></script> + <script type="text/javascript" src="/mail/static/src/js/many2many_tags_email.js"></script> <script type="text/javascript" src="/mail/static/src/js/many2one_avatar_user.js"></script> <script type="text/javascript" src="/mail/static/src/js/field_char.js"></script> |
