-
-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(differentDomains): handling of runtime domains from store #1183
Conversation
…hen differentDomains is true
…cales before extending the vue instance so app.i18n can get the store domains in the locale array and localProperties object. Fix getLocaleDomain not finding the correct domain when using differentDomains
Sorry for the delay. I'll try to understand and review it soon. For now have only one initial thought that it's likely not safe to assume that runtime configuration is supported by this module. Thus making some cases handle runtime configuration is still not likely gonna be flawless. |
✔️ Deploy Preview for nuxt-i18n canceled. 🔨 Explore the source changes: 8a50da7 🔍 Inspect the deploy log: https://app.netlify.com/sites/nuxt-i18n/deploys/61143c08b0da150007cac4cc |
Thanks. Sorry for a very long wait. |
No worries at all! Happy to take the discussion further if you want to improve the solution 👍 |
Following documentation https://i18n.nuxtjs.org/different-domains/#runtime-environment-variables. Configuring nuxt-i18n using
differentDomains: true
and defining the domains only in the store using with runtime environment variables end up with the warningCould not find domain name for locale xx
.The issue is that domain matching is made using
options.normalizedLocales
which is not updated with the domains from the store: https://github.com/nuxt-community/i18n-module/blob/master/src/templates/plugin.main.js#L370-L375.This PR aims to update
options.locales
instead ofapp.i18n.locales
since it is based on it, and updateoptions.normalizedLocales
soapp.i18n.localeProperties
contains thedomain
property andgetLocaleDomain
method can match a provided domain.It also update the
onNavigate
method so we don't try to get the locale from the route when using differentDomains since the route wont contain the proper locale.