Join the Webstudio community

Updated last week

Language switcher again 🌐

Posting this request again.
How can we implement a language switcher please.
Content is from Hygraph with languages enabled

In WS, English default pages are on root and duplicated translation pages are in folder AR

URLs are set up fine "website.com/ar/news" (for arabic)
"website.com/news" (For default english)
Content is appearing correctly too.

Need to implement a switcher in navigation that directs to /ar/ version without taking user back to homepage

It's for a large-ish site we're rebuilding and wanting client to move from WordPress to WebStudio . It is unfortunately time-based so need to finalize this soon so we don't have to continue new site on Wp again

Thanks a lot
Attachment
image.png
O
m
5 comments
So did you try writing a bit of js for this?
I tried multiple methods via chatgpt tbh
Also one user suggested another JS too but none worked unfortunately
Something like this worked only on first page load as it reads the URL but after that it doesn't
Attachment
image.png
what doesn't work, can you show an example and the exact problem?
I tried this again now with fresh slot and tested in published version again and this above script solved the switcher . I must be doing somethign wrong in previous version
sorry and thanks again
Add a reply
Sign up and join the conversation on Discord