fix: Add preference to choose browser lang for widget settings page (#5726)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
committed by
GitHub
parent
bcde84b5b5
commit
abe439594e
@@ -18,6 +18,11 @@ const runSDK = ({ baseUrl, websiteToken }) => {
|
||||
}
|
||||
|
||||
const chatwootSettings = window.chatwootSettings || {};
|
||||
let locale = chatwootSettings.locale || 'en';
|
||||
if (chatwootSettings.useBrowserLanguage) {
|
||||
locale = window.navigator.language.replace('-', '_');
|
||||
}
|
||||
|
||||
window.$chatwoot = {
|
||||
baseUrl,
|
||||
hasLoaded: false,
|
||||
@@ -25,7 +30,8 @@ const runSDK = ({ baseUrl, websiteToken }) => {
|
||||
isOpen: false,
|
||||
position: chatwootSettings.position === 'left' ? 'left' : 'right',
|
||||
websiteToken,
|
||||
locale: chatwootSettings.locale,
|
||||
locale,
|
||||
useBrowserLanguage: chatwootSettings.useBrowserLanguage || false,
|
||||
type: getBubbleView(chatwootSettings.type),
|
||||
launcherTitle: chatwootSettings.launcherTitle || '',
|
||||
showPopoutButton: chatwootSettings.showPopoutButton || false,
|
||||
@@ -58,7 +64,7 @@ const runSDK = ({ baseUrl, websiteToken }) => {
|
||||
IFrameHelper.events.popoutChatWindow({
|
||||
baseUrl: window.$chatwoot.baseUrl,
|
||||
websiteToken: window.$chatwoot.websiteToken,
|
||||
locale: window.$chatwoot.locale,
|
||||
locale,
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user