summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/core/translation.js
blob: faecafaff03a14dd541eb59a564334e5abe535e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
    },
});

});