diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py index a2974c36ffa..1ad0b94135e 100644 --- a/addons/im_livechat/controllers/main.py +++ b/addons/im_livechat/controllers/main.py @@ -85,6 +85,8 @@ class LivechatController(http.Controller): # find the first matching rule for the given country and url matching_rule = request.env['im_livechat.channel.rule'].sudo().match_rule(channel_id, url, country_id) if matching_rule and (not matching_rule.chatbot_script_id or matching_rule.chatbot_script_id.script_step_ids): + frontend_lang = request.httprequest.cookies.get('frontend_lang', request.env.user.lang or 'en_US') + matching_rule = matching_rule.with_context(lang=frontend_lang) rule = { 'action': matching_rule.action, 'auto_popup_timer': matching_rule.auto_popup_timer, @@ -153,7 +155,8 @@ class LivechatController(http.Controller): chatbot_script = False if chatbot_script_id: - chatbot_script = request.env['chatbot.script'].sudo().browse(chatbot_script_id) + frontend_lang = request.httprequest.cookies.get('frontend_lang', request.env.user.lang or 'en_US') + chatbot_script = request.env['chatbot.script'].sudo().with_context(lang=frontend_lang).browse(chatbot_script_id) return request.env["im_livechat.channel"].with_context(lang=False).sudo().browse(channel_id)._open_livechat_discuss_channel( anonymous_name,