Adding a locale to every path
Hi, I'm migrating an app to tanstack router ATM, and it has locale-aware routes, like
<basename>/en/<route>. The way they're doing this currently is by manually checking then adjusting window.location.pathname on every page load via an event listener. The locale is stored on the window object. If the locale changes, it hits an API for new translations then updates the stored value & so on.
I don't really want this: I just want a declarative method of prefixing the pathname with the locale, and I can handle storing the value. User goes to mysite.com, url visible is mysite.com/en, user goes to login, mysite.com/en/login etc etc.
Route masking seems close, but almost seems the inverse of what I need. Can anyone give any advice on how I'd set this up?
Edit: ah, it's identical to next.js' i18n subpath routing that I'm trying to implement0 Replies