You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey!
I'm currently working on uniform application, with support of many languages in different configurations.
Problem
Application is deployed independently in different environments, some of which have only a subset of all languages in the app. So, page A have english and polish, but site B has only polish. Currently I need to create different builds (different docker images) of the same application instead of just one. There is also no way to set a defaultLocale in the runtime, as it always reads the initial config.
I'm aware of the bundle.onlyLocales option, but it only works on buildtime.
Solution
Introduce an environment variable, that allows to enable or disable locales in the runtime.
My suggestion is: NUXT_PUBLIC_I18N_LOCALES_{code}_DISABLED, similar to existing NUXT_PUBLIC_I18N_LOCALES_{code}_DOMAIN env.
If given locale would be disabled, it wouldn't show in i18n.locales list. Basically it would not exists in the application.
I'm aware, that the messages for that locale would be included in the build, but i think it's fine.
Also, i suggest introduce NUXT_PUBLIC_I18N_DEFAULT_LOCALE environment variable. It would works just like i18n.defaultLocale but overrides default value.
Additional information
Would you be willing to help implement this feature?
Could this feature be implemented as a module?
Final checks
Read the contribution guide (The contribution guideline of nuxt-modules/i18n is compliant with Nuxt too).
The biggest obstacle to make this work would be route generation which uses defaultLocale and strategy at build time, I suppose this may not necessarily be an issue for strategy: 'no_prefix'.
Describe the feature
Hey!
I'm currently working on uniform application, with support of many languages in different configurations.
Problem
Application is deployed independently in different environments, some of which have only a subset of all languages in the app. So, page A have english and polish, but site B has only polish. Currently I need to create different builds (different docker images) of the same application instead of just one. There is also no way to set a
defaultLocale
in the runtime, as it always reads the initial config.I'm aware of the
bundle.onlyLocales
option, but it only works on buildtime.Solution
Introduce an environment variable, that allows to enable or disable locales in the runtime.
My suggestion is:
NUXT_PUBLIC_I18N_LOCALES_{code}_DISABLED
, similar to existingNUXT_PUBLIC_I18N_LOCALES_{code}_DOMAIN
env.If given locale would be disabled, it wouldn't show in
i18n.locales
list. Basically it would not exists in the application.I'm aware, that the messages for that locale would be included in the build, but i think it's fine.
Also, i suggest introduce
NUXT_PUBLIC_I18N_DEFAULT_LOCALE
environment variable. It would works just likei18n.defaultLocale
but overrides default value.Additional information
Final checks
The text was updated successfully, but these errors were encountered: