-
-
Notifications
You must be signed in to change notification settings - Fork 350
Description
Is your feature request related to a problem? Please describe.
Currently, when using domain-based routing with next-intl, all domains must follow the same localePrefix mode (e.g., always, never, or as-needed). This creates limitations when different domains have different requirements for locale prefix behavior.
For example, you might want:
- A single-locale domain (e.g.,
us.example.com) to never show locale prefixes - A multi-locale domain (e.g.,
ca.example.com) to always show locale prefixes for clarity
The current workaround requires building the app separately for each domain with different configurations, which is not ideal for deployment and maintenance.
Describe the solution you'd like
Allow each domain in the domains configuration to optionally specify its own localePrefix mode that overrides the global setting:
export const routing = defineRouting({
locales: ['en-US', 'en-CA', 'fr-CA'],
defaultLocale: 'en-US',
domains: [
{
domain: 'us.example.com',
defaultLocale: 'en-US',
locales: ['en-US'],
localePrefix: 'never' // Override: no prefix on this domain
},
{
domain: 'ca.example.com',
defaultLocale: 'en-CA',
locales: ['en-CA', 'fr-CA'],
localePrefix: 'always' // Override: always show prefix on this domain
}
],
localePrefix: 'as-needed' // Global default
});Describe alternatives you've considered
I considered using separate builds per domain (as described in the docs), but I would prefer not to because: Increases build time, deployment complexity, and maintenance burden. Also increases our runtime costs.