i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Don't load default locale when differentDomain is true

Open enwin opened this issue 7 months ago • 0 comments

Describe the feature

The project I'm working on right now is a website with 4 different languages, each one tied to a domain. The same nuxt app is supposed to handle these 4 domains. Since each domain can only have one locale, I use the lazy option to only load the locale matching the domain. Unfortunately, the i18n module still tries to load the defaultLocale as well, and if it's not defined, I get a warning.

See this line for the part where the default locale is added to the list of locales: https://github.com/nuxt-modules/i18n/blob/ca3fe042351e64ce055436d5d89fcc061e9fd9f8/src/runtime/messages.ts#L66

Could it be possible to add a case like when lazy && options.strategy === "no_prefix" && options.differentDomains to not add the defaultLocale to the pool of locales to fetch?

I'm adding this as a feature request since my case can be a bit specific. Maybe there's more complexity to handle than just this simple if.

Thank you for taking the time to read this request. Let's talk!

Additional information

  • [X] Would you be willing to help implement this feature?
  • [ ] Could this feature be implemented as a module?

Final checks

enwin avatar Jul 01 '24 13:07 enwin