i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Support complex multi-domain i18n configurations in a single build

Open Ereaey opened this issue 5 months ago • 5 comments

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.ca with fr and en)
    • Others use prefix (e.g., site.be with fr and nl)

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

Ereaey avatar Jul 22 '25 22:07 Ereaey

+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.

OlePc avatar Aug 20 '25 11:08 OlePc

+1 for this.

Quineone avatar Oct 09 '25 06:10 Quineone

+1 for this aswell !

LindseyLouv avatar Oct 09 '25 07:10 LindseyLouv

+1

romain-banchetti avatar Oct 15 '25 12:10 romain-banchetti

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

Image

JoniJnm avatar Dec 03 '25 18:12 JoniJnm