From 412303d1cd9f7cd804c737fcf366f81eb82039ad Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 8 Oct 2024 15:20:35 +0530 Subject: [PATCH] chore: try i18n --- app/javascript/dashboard/App.vue | 2 +- .../dashboard/routes/dashboard/settings/account/Index.vue | 4 ++-- app/javascript/survey/views/Response.vue | 2 +- app/javascript/v3/App.vue | 2 +- app/javascript/widget/App.vue | 4 ++-- app/javascript/widget/components/HeaderActions.vue | 7 +------ app/javascript/widget/components/PreChat/Form.vue | 2 +- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/app/javascript/dashboard/App.vue b/app/javascript/dashboard/App.vue index 5d693c6c3..07803f01e 100644 --- a/app/javascript/dashboard/App.vue +++ b/app/javascript/dashboard/App.vue @@ -99,7 +99,7 @@ export default { mql.onchange = e => setColorTheme(e.matches); }, setLocale(locale) { - this.$root.$i18n.locale = locale; + this.$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 1575344cb..0ea6f0562 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/account/Index.vue @@ -112,7 +112,7 @@ export default { latest_chatwoot_version: latestChatwootVersion, } = this.getAccount(this.accountId); - this.$root.$i18n.locale = locale; + this.$i18n.locale = locale; this.name = name; this.locale = locale; this.id = id; @@ -140,7 +140,7 @@ export default { support_email: this.supportEmail, auto_resolve_duration: this.autoResolveDuration, }); - this.$root.$i18n.locale = this.locale; + this.$i18n.locale = this.locale; this.getAccount(this.id).locale = this.locale; this.updateDirectionView(this.locale); useAlert(this.$t('GENERAL_SETTINGS.UPDATE.SUCCESS')); diff --git a/app/javascript/survey/views/Response.vue b/app/javascript/survey/views/Response.vue index 86aa6f780..50fde4a8c 100644 --- a/app/javascript/survey/views/Response.vue +++ b/app/javascript/survey/views/Response.vue @@ -120,7 +120,7 @@ export default { } }, setLocale(locale) { - this.$root.$i18n.locale = locale || 'en'; + this.$i18n.locale = locale || 'en'; }, }, }; diff --git a/app/javascript/v3/App.vue b/app/javascript/v3/App.vue index 1bf3d561b..8d54b28f6 100644 --- a/app/javascript/v3/App.vue +++ b/app/javascript/v3/App.vue @@ -31,7 +31,7 @@ export default { }; }, setLocale(locale) { - this.$root.$i18n.locale = locale; + this.$i18n.locale = locale; }, }, }; diff --git a/app/javascript/widget/App.vue b/app/javascript/widget/App.vue index 4fa6f4dc6..3001a0dfd 100755 --- a/app/javascript/widget/App.vue +++ b/app/javascript/widget/App.vue @@ -132,9 +132,9 @@ export default { ); if (hasLocaleWithVariation) { - this.$root.$i18n.locale = localeWithVariation; + this.$i18n.locale = localeWithVariation; } else if (hasLocaleWithoutVariation) { - this.$root.$i18n.locale = localeWithoutVariation; + this.$i18n.locale = localeWithoutVariation; } }, registerUnreadEvents() { diff --git a/app/javascript/widget/components/HeaderActions.vue b/app/javascript/widget/components/HeaderActions.vue index 6aeab6648..82a8265a7 100644 --- a/app/javascript/widget/components/HeaderActions.vue +++ b/app/javascript/widget/components/HeaderActions.vue @@ -60,12 +60,7 @@ export default { chatwootWebChannel: { websiteToken }, authToken, } = window; - popoutChatWindow( - origin, - websiteToken, - this.$root.$i18n.locale, - authToken - ); + popoutChatWindow(origin, websiteToken, this.$i18n.locale, authToken); }, closeWindow() { if (IFrameHelper.isIFrame()) { diff --git a/app/javascript/widget/components/PreChat/Form.vue b/app/javascript/widget/components/PreChat/Form.vue index 6b2c93cd6..f74430eb1 100644 --- a/app/javascript/widget/components/PreChat/Form.vue +++ b/app/javascript/widget/components/PreChat/Form.vue @@ -37,7 +37,7 @@ export default { }, data() { return { - locale: this.$root.$i18n.locale, + locale: this.$i18n.locale, hasErrorInPhoneInput: false, message: '', formValues: {},