Slug before localization
Unanswered
Giant panda posted this in #help-forum
Giant pandaOP
Hi I’m working currently on a project that is using localization, the thing is that currently we need to move the locale inside a dynamic route.
Ex: /slug/locale
I was wondering if there is a way to get that slug to work.
Ex: /slug/locale
I was wondering if there is a way to get that slug to work.
4 Replies
American Crow
Not sure what you are asking excatly.
A library like next-intl does wht you describe. Just the other way around, e.g: /locale/slug
That's the setup it requires to do other localization taks like rewriting slugs, language switching, middleware, alternate href headers and so on
A library like next-intl does wht you describe. Just the other way around, e.g: /locale/slug
That's the setup it requires to do other localization taks like rewriting slugs, language switching, middleware, alternate href headers and so on
Giant pandaOP
We are using next-intl for that but the issue we have right now is that the client wants that [company] before the locale as that part will be dynamic. I’m not sure if it will be possible to create a static param that represents the slug. I was wondering if there is a way to put the slug before the localization
American Crow
only via rewrites imo. You'd have to keep next-intl structure, so
Disable Locale Prefixes all together
And rewrite the paths in the middlware
But i dont know that sounds stupid writing it
[locale]
[company]Disable Locale Prefixes all together
export default createMiddleware({
// ... other config
localePrefix: 'never'
});And rewrite the paths in the middlware
But i dont know that sounds stupid writing it
Giant pandaOP
Is there a way to inject the slug to the locale ? Instead of having it like what you explain above something like [company/locale]