Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support localePrefix setting per domain #1055

Open
markoleavy opened this issue May 6, 2024 · 0 comments
Open

Support localePrefix setting per domain #1055

markoleavy opened this issue May 6, 2024 · 0 comments
Labels
contributions welcome Good for people looking to contribute enhancement New feature or request

Comments

@markoleavy
Copy link

markoleavy commented May 6, 2024

Is your feature request related to a problem? Please describe.

It would be really useful being able to configure a localePrefix preference per domain, in the domain config objects.

Describe the solution you'd like

Being able to declare a prop inside the domain object and that overrides the default behavior would fix this issue.

export default createMiddleware({
  defaultLocale: 'en-US',
  locales: ['en-US', 'fr-FR', 'en-GB', 'de-DE', 'it-IT']
  domains: [
    {
      domain: 'www.mywebsite.it',
      defaultLocale: 'it-IT',
      localePrefix: 'as-needed',
      locales: ['it-IT']
    },
    {
      domain: 'www.mywebsite.com',
      defaultLocale: 'en-US',
      localePrefix: 'always',
      locales: ['en-US', 'fr-FR', 'en-GB', 'de-DE']
    }
  ]
});

Describe alternatives you've considered

As explained in discussion #1030, at the moment is possible to use an empty string as default locale to get kind of a "always" behavior while "as-needed" is selected in main config.
This is not a documented feature, and might break in the future.

@markoleavy markoleavy added enhancement New feature or request unconfirmed Needs triage. labels May 6, 2024
@amannn amannn added contributions welcome Good for people looking to contribute and removed unconfirmed Needs triage. labels May 7, 2024
@amannn amannn changed the title localPrefix option in DomainConfig Support localePrefix setting per domain May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome Good for people looking to contribute enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants