[FIX] im_livechat: translate livechat button text per user language

Before this commit, the livechat button text was not considering
the language of the user for translation. The translation must
not be loaded at field initialization, but when the value is
accessed e.g. from a livechat visitor.

closes odoo/odoo#112936

X-original-commit: 48dbf94068e09d831e4bf262b70b11adaade4b57
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2023-02-17 12:07:34 +01:00
parent 30950f83b9
commit 9ee7bdaec5
2 changed files with 9 additions and 2 deletions
+1
View File
@@ -814,6 +814,7 @@ msgstr ""
#. module: im_livechat
#. odoo-javascript
#: code:addons/im_livechat/static/src/public_models/livechat_button_view.js:0
#: code:addons/im_livechat/models/im_livechat_channel.py:0
#, python-format
msgid "How may I help you?"
msgstr ""
@@ -26,11 +26,17 @@ class ImLivechatChannel(models.Model):
def _default_user_ids(self):
return [(6, 0, [self._uid])]
def _default_button_text(self):
return _('Have a Question? Chat with us.')
def _default_default_message(self):
return _('How may I help you?')
# attribute fields
name = fields.Char('Channel Name', required=True)
button_text = fields.Char('Text of the Button', default=_('Have a Question? Chat with us.'),
button_text = fields.Char('Text of the Button', default=_default_button_text,
help="Default text displayed on the Livechat Support Button", translate=True)
default_message = fields.Char('Welcome Message', default='How may I help you?',
default_message = fields.Char('Welcome Message', default=_default_default_message,
help="This is an automated 'welcome' message that your visitor will see when they initiate a new conversation.", translate=True)
input_placeholder = fields.Char('Chat Input Placeholder', help='Text that prompts the user to initiate the chat.', translate=True)
header_background_color = fields.Char(default="#875A7B", help="Default background color of the channel header once open")