TanStackT
TanStack16mo ago
2 replies
colossal-harlequin

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.
Was this page helpful?