diff --git a/app/javascript/dashboard/App.vue b/app/javascript/dashboard/App.vue index 8912c03d1..a706e2df5 100644 --- a/app/javascript/dashboard/App.vue +++ b/app/javascript/dashboard/App.vue @@ -98,7 +98,9 @@ export default { mql.onchange = e => setColorTheme(e.matches); }, setLocale(locale) { - this.$root.$i18n.locale = locale; + if (locale) { + this.$root.$i18n.locale = locale; + } }, async initializeAccount() { await this.$store.dispatch('accounts/get'); diff --git a/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue index 5be704c24..0502ebc1b 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue @@ -103,7 +103,10 @@ export default { const { name, locale, id, domain, support_email, features } = this.getAccount(this.accountId); - this.$root.$i18n.locale = this.uiSettings?.locale || locale; + const effectiveLocale = this.uiSettings?.locale || locale; + if (effectiveLocale) { + this.$root.$i18n.locale = effectiveLocale; + } this.name = name; this.locale = locale; this.id = id; @@ -129,11 +132,9 @@ export default { support_email: this.supportEmail, }); // If user locale is set, update the locale with user locale - if (this.uiSettings?.locale) { - this.$root.$i18n.locale = this.uiSettings?.locale; - } else { - // If user locale is not set, update the locale with account locale - this.$root.$i18n.locale = this.locale; + const updatedLocale = this.uiSettings?.locale || this.locale; + if (updatedLocale) { + this.$root.$i18n.locale = updatedLocale; } this.getAccount(this.id).locale = this.locale; useAlert(this.$t('GENERAL_SETTINGS.UPDATE.SUCCESS')); diff --git a/app/javascript/v3/App.vue b/app/javascript/v3/App.vue index ef7107beb..c3f9b1734 100644 --- a/app/javascript/v3/App.vue +++ b/app/javascript/v3/App.vue @@ -35,7 +35,9 @@ export default { }; }, setLocale(locale) { - this.$root.$i18n.locale = locale; + if (locale) { + this.$root.$i18n.locale = locale; + } }, }, };