Support custom parsing of locale url in sub-path routing #28245
Replies: 5 comments
-
I need the same thing, and currently not using the Link component provided by next, and have a function to structure the correct url |
Beta Was this translation helpful? Give feedback.
-
I need custom subpaths, |
Beta Was this translation helpful? Give feedback.
-
Same wishes! |
Beta Was this translation helpful? Give feedback.
-
any updates? |
Beta Was this translation helpful? Give feedback.
-
any updates here? thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
Currently next.js supports only sub-path locale detection when URL is in format example.com/locale/path. I would like to be able to use URLs in format example.com/country-locale/path where country is locale my app uses to decide which content it should show.
There has been a few discussions about that (https://github.com/vercel/next.js/discussions/21871, https://github.com/vercel/next.js/discussions/25215) but none of them is feature request so I post a new one.
Describe the solution you'd like
I would like to be able to define in i18n options a parameter which determines how subpath should be parsed e.g
i18n: { locales: ['en-US', 'fr', 'nl-NL'], defaultLocale: 'en-US', subpathFormat: 'country-locale', }
I am willing to help implementing this feature or implement it as a whole.
Describe alternatives you've considered
I have considered using other strategies such as domain routing and supported form of sub-path localization, but I need other format due to backwards compatibility.
Beta Was this translation helpful? Give feedback.
All reactions