Support configuring locale prefix strategy per route group #477
-
Use caseI have an application with two different route groups:
For the public routes, I want to expose the locale in the URL, for example:
using the "no prefix for default locale" strategy. However, for authenticated routes, I don't want the locale to appear in the URL at all. Instead, the application should resolve the locale from the authenticated user's preference, for example:
without any locale prefix. Current limitationAs I understand it, the locale prefix strategy is currently configured globally (e.g. This means the same strategy is applied to every route, regardless of its purpose. Current workaroundThe approach I'm currently experimenting with is to avoid wrapping the entire application with a single Instead:
This setup gives each route group its own localization source and achieves the desired behavior, but it feels more like a workaround than a first-class solution. ProposalWould it make sense to support configuring the locale prefix strategy per route group (or per route tree)? Something conceptually like:
This would allow applications to have SEO-friendly localized public pages while keeping authenticated areas clean and relying on the user's stored language preference. I'm curious if there's already a recommended way to achieve this with the current API, or if this use case aligns with the library's design goals. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Ooh, that's a super interesting suggestion! But the limitations are:
I'm a bit concerned that this would hurt the ergonomics, so I'll probably pass on this feature for now. However, the URL rewrite feature already exists and might solve your use case: |
Beta Was this translation helpful? Give feedback.
Ooh, that's a super interesting suggestion! But the limitations are:
I'm a bit concerned that this would hurt the ergonomics, so I'll probably pass on this feature for now.
However, the URL rewrite feature already exists and might solve your use case:
https://intlayer.org/doc/concept/custom_url_rewrites