i18n
i18n copied to clipboard
change available languages at runtime
Describe the feature
there are times when i18n options need to be changed at runtime. now there is no way to do this, or I did not find how to do it. i see this one as Nuxt hook before initialization Vue I18n.
specifically, I need the functionality of limiting available languages based on information from useRequestHeaders
Additional information
- [X] Would you be willing to help implement this feature?
- [ ] Could this feature be implemented as a module?
Final checks
- [X] Read the contribution guide (The contribution guideline of nuxt-modules/i18n is compliant with Nuxt too).
- [X] Check existing discussions and issues.
Thank you for your feedback. I backed from short vacation.
would you like to get more information from you about the use case with more detail and some codes. we would not be able to understand your issue...
I want to have a nuxt hook named "i18n:config" that will allow me to extend and change the configuration of a module. just like on vite
Hey guys , i have the same problem and i want set locales from my CMS with API request ..
Since the module relies on the build step to generate configs and routes it may not be possible to extend/add locales at runtime.. (at least right now).
Limiting/disabling configured locales should be possible already using a middleware I think, could you provide some examples of what the usage of this feature would look like?
Since the module relies on the build step to generate configs and routes it may not be possible to extend/add locales at runtime.. (at least right now).
Limiting/disabling configured locales should be possible already using a middleware I think, could you provide some examples of what the usage of this feature would look like?
yes , we have a shop builder with some templates, we created some plugins for our users that one of them is multi language plugin. so users can turns the plugin on or off or they can select their default locale from the panel. i want to make default locale or i18n object dynamic. i think this is a useful feature
Yep, we have a very similar use case to @yazdanqm as well. This one would be nice to have, otherwise we need to do cross-checking in multiple places between our available locales and the complete set of locales defined in our nuxtI18n config
Lazy-load translations
nuxt-project/ ├── lang/ │ ├── en-US.json │ ├── [code].ts ├── nuxt.config.ts