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:
parent
bcde84b5b5
commit
abe439594e
3 changed files with 22 additions and 5 deletions
|
@ -134,10 +134,20 @@ export default {
|
|||
});
|
||||
});
|
||||
},
|
||||
setLocale(locale) {
|
||||
setLocale(localeWithVariation) {
|
||||
const { enabledLanguages } = window.chatwootWebChannel;
|
||||
if (enabledLanguages.some(lang => lang.iso_639_1_code === locale)) {
|
||||
this.$root.$i18n.locale = locale;
|
||||
const localeWithoutVariation = localeWithVariation.split('_')[0];
|
||||
const hasLocaleWithoutVariation = enabledLanguages.some(
|
||||
lang => lang.iso_639_1_code === localeWithoutVariation
|
||||
);
|
||||
const hasLocaleWithVariation = enabledLanguages.some(
|
||||
lang => lang.iso_639_1_code === localeWithVariation
|
||||
);
|
||||
|
||||
if (hasLocaleWithVariation) {
|
||||
this.$root.$i18n.locale = localeWithVariation;
|
||||
} else if (hasLocaleWithoutVariation) {
|
||||
this.$root.$i18n.locale = localeWithoutVariation;
|
||||
}
|
||||
},
|
||||
registerUnreadEvents() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue