S
SolidJS2mo ago
Wirkhof

How do I set up different languages in routes in SS?

let's say I want: /about-us for English (no en in the url) and /es/sobre-nosotros for Spanish (notice the es that is mandatory) How to do that in SS?
3 Replies
peerreynders
peerreynders2mo ago
I'm not aware of anything right now and even in the future I would expect this be a community package rather than a core feature because different dev audiences have distinct preferences for how their preferred mechanisms work. So if this was my problem right now I'd look into implementing the /about-us route component by selecting the appropriate content based on the user settings and perhaps instantiate it with Dynamic. If a route change is required the /about-us could simply implement the English version while checking the user's locale and using Navigate to go to a specifically supported language like /es/sobre-nosotros.
peerreynders
peerreynders2mo ago
There is i18n and I'm wondering whether the language dictionaries could be hijacked to provide language specific href values to populate the links in the JSX with.
Solid Primitives
A library of high-quality primitives that extend SolidJS reactivity
mdynnl
mdynnl2mo ago
1. route groups via filesystem routing or manual jsx definition 2. dynamic params, (optional params if you want optional locale) 3. route match filters to filter against a list of available locales 4. getting the current locale from location or fallback 5. figure out a way to update the lang on client side 6. a way to change the locale client side 7. redirecting from default locale to locale-less url if desired 8. potentially you can use any method for storing the locale data the actual implementation that feels ergonomic might take some effort and thinking though it definitely makes sense to have these features handled by a community package though potentially it can also have different strategies to get the locale like cookies