Does wasp support preceeding route param eg. "/:lang/dashboard" ?
I want to have pages in different languages so i would like to set up the following routes:
/:lang/dashboard
/:lang/account
...
If not, what can I do as a workaround? thanks!
3 Replies
Wohooo @N, you just became a Waspeteer level 1!
Hi @N. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, Wasp does support preceding route parameters like "/:lang/dashboard". You can add parameters to the URL path using the same syntax as React Router. Here's an example from the Wasp tutorial:
In your case, you can set up your routes like this:
When a user visits "/en/dashboard" or "/fr/account", Wasp will render the corresponding component and pass the URL parameter (
lang
) the same way as in React Router. You can then use this lang
parameter to display the page in the appropriate language.
For more details, you can refer to the Wasp tutorial on adding a second page (https://wasp-lang.dev/docs/tutorial/pages#adding-a-second-page).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @N, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Have you tried it and it didn't work? 🙂 That seems like the best way to find out if it'll work. I believe it should work, we are using the React Router library under the hood for routing.