-
Hi, I am somehow not capable of changing the locale everywhere on the app. I am also struggling with the documentation as I have to deal with Express + Vue 3 + Composition API + SFC + vite making this configuration a maze. So some configuration:
in main.js
Basically in every component I am using translations from en.json/nl.json/de.json and LOCAL translations. Like custom block translations from the
So, because I am using this custom block So far this works. However when I do a locale change, I have issues that I can't solve. There are two ways to change the locale, but none actually change the language EVERYWHERE. OPTION 1 (only local scope)
This will only change the language in this component as expected. OPTION 2 (using $i18n from globalInjection)
With this way, when I change the language, the language of this component changes and the language of SIBLING components change. But all the other components including even the parent component do not change??? It is very weird. When I try v-model="$root.$i18n.locale" then the exact same happens. The structure of the app is Basically changing the language in userProfileTab.vue changes the language in userProfileTab.vue/userOtherTab.vue/userOther2Tab.vue and also Admin1Tab/Admin2Tab/Admin3Tab but not in userSettingsModal.vue, adminSettingsModal.vue, mainView.vue and routerView Anyone help me with this maze of a configuration. The documentation is confusing to me as there's a section on SFC, a section on Composition API and then there is the You might ask why I want en.json/nl.json/de.json and the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
userSettingsModal.vue, adminSettingsModal.vue, mainView.vue and routerView use custom block and Composition API? If you are creating an i18n application that uses both local scope and global scope with custom block, you should basically use global scope. |
Beta Was this translation helpful? Give feedback.
userSettingsModal.vue, adminSettingsModal.vue, mainView.vue and routerView use custom block and Composition API?
If so, you need to set
inheriteLocale: true
inuseI18n
.If you are creating an i18n application that uses both local scope and global scope with custom block, you should basically use global scope.
You should then design localization to determine which scope to use for your application's use cases.
In general, the global scope method should be sufficient. This will make it easier to work with the localization service and allow for integration with the localization workflow.