Support complex multi-domain i18n configurations in a single build
Describe the feature
Description
Hi there, I'm working on a Nuxt project that needs to serve multiple countries, each on a separate domain. Each domain has its own i18n requirements:
-
Some domains have only one official language (e.g.,
site.fr→ French only, no prefix needed). -
Others have multiple languages, and the strategy varies:
- Some use
prefix_except_default(e.g.,site.cawithfranden) - Others use
prefix(e.g.,site.bewithfrandnl)
- Some use
Constraints:
- I want to use a single Nuxt build to serve all domains.
- I need to dynamically adapt the i18n config (strategy, locales, defaultLocale) based on the current domain (host).
- I also need to detect the current domain at runtime (server & client) to configure things like API base URLs.
- Compatible with SSR & SEO
Problem
Currently, I need to generate and deploy one build per domain to accommodate the differences in strategy, defaultLocale, and available locales. That means I must build the app 8 times, which is time-consuming and hard to maintain.
Question
Is there currently any official or recommended way to support multiple domains with different i18n strategies using a single build?
If not, would this be considered a valid feature request, or are there technical constraints that prevent this kind of setup?
Thanks a lot for your help!
Additional information
- [ ] 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.
+1 for this. I've used layers in Nuxt to differentiate between the different site configurations I need. The issue is that a layer has to be set at build time, so I need a build per configuration. I would love to be able to override strategy, locales, and defaultLocale using runtime environment variables. I've tried to override the default values using plugins in Nuxt, but the timing is tricky and you end up with a lot of side effects.
+1 for this.
+1 for this aswell !
+1
In my case I need to change the defaultLocale and also disable some locales dynamically
Seems like changing the defaultLocale is not easy because strategy: 'prefix_and_default' + pages property generates the routes during build time