TanStackT
TanStack4mo ago
5 replies
foolish-indigo

i18n with optional locale param?

I see the example in here https://tanstack.com/router/latest/docs/framework/react/guide/path-params#type-safety-for-i18n

And it uses optional locale param.
Also, there is this example
https://tanstack.com/router/latest/docs/framework/react/examples/basic-ssr-file-based

that has the head in the
__root
route.
I want to alter the head and also the <html lang={...}> of the RootComponent, based on the locale.
But as I understand, locale is not defined yet in the root route? It gets defined only in it's childern, `root/__main/{-$locale}/...` ?
An example showing how to implement Basic Ssr File Based in React using TanStack Router.
Path params are used to match a single segment (the text until the next /) and provide its value back to you as a named variable. They are defined by using the $ character prefix in the path, followed...
Was this page helpful?