-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
Description
Describe the feature you'd like to request
Currently domainLocales is specified as an optional field on the return of useRouter but in looking at the client version of router.ts it actually is never initialized. We would like access to this so we can restrict what languages to present to the user in our language picker based on what domain they are visiting.
Describe the solution you'd like
For example config:
{
i18n: {
domains: [
{
domain: 'x.com',
defaultLocale: 'en-US',
locales: ['en-US', 'es'],
},
{
domain: 'x.in',
defaultLocale: 'en-IN',
locales: ['en-IN'],
},
],
locales: ['en-IN', 'en-US', 'es'],
defaultLocale: 'en-US',
},
}If the user lands on x.com the intent is for router.domainLocales to only have ["en-US", "es"] client-side so we are not showing undesired locales.
Describe alternatives you've considered
The only real alternative is to also maintain this mapping in our src directory and do hostname switching. It works but the types for useRouter imply that this field should be available.
Metadata
Metadata
Assignees
Labels
No labels