T
TanStack12mo ago
adverse-sapphire

Best way to do optional path params (for i18n)? Virtual routes?

Hey everyone! We've been experimenting with Tanstack Start and Router for a frontend refactor of an app we have. One of the requirements is optional path prefixes for i18n, i.e. /todos/:id should be identical to /en/todos/:id if en is the fallback language, otherwise prefixes are specified for all other languages. Is there a way to achieve this with router? We've been trying with virtual routes, but it seems codegen goes all over the place when you combine root-level virtual routes with Tanstack Start. With every combination we tried the codegen hangs trying to generate routes.
1 Reply
harsh-harlequin
harsh-harlequin12mo ago
tanstack router does not support optional path params yet if you need this feature, please consider the following: we always value contributions. so if you think you can implement this feature, please let us know. however, I think in this particular case, especially getting the typings correct will be challenging. getting this implemented could also be achieved by sponsoring the project / individual maintainers. If this is a viable option for you, please get in touch as well.

Did you find this page helpful?