Streaming live at 10am (PST)

Link directly to respective language with Weglot

I’m trying out Weglot to add Swedish translation to a Norwegian page where our visitors can download whitepapers in pdf format. We send them directly to a collection template page, so each whitepaper has it’s own page, and the collection will have a field for locale at first for identification.
So far it seems to work like magic, but I’m not sure how to handle an specific scenario:

  • Visitor clicks on link to this page on the Swedish blog, but his browser is in english. Since Norwegian is the original content, how can I assure the visitor lands on the Swedish translated page instead of the fallback (no)?

Is there a way to use queries on the URL? Clicking the Weglot button with js wouldn’t be ideal because it would flash Norwegian for a second.

@eugene_weglot I’d be very immensily happy if you can point out the right direction! :pray:

I started writing a javascript using URLSearchParams but apparently it worked without it just by adding ?lang= + “2-letter code of a language” to my url.

Appreciate if someone can confirm that.

Hey @vanpaio,
Weglot has an autoswitch feature:

It automatically switches the user depending on his web browser language. If you activate it, you can then select a preferred fallback language.

Hope this helps!

Thanks @eugene_weglot but I wanted to avoid the auto redirect based on browser language, since in some scenarios the content in the page will be in a specific language, thus I want to avoid the risk of showing the fallback language and cause any confusion.

My post above actually solved it, apparently the eg ?lang=sv is a native feature which I did not find in the documentation.

Yes, you can use the ?lang=xx parameter in this situation.

Thank you for the feedback. It should be in our documentation for sure. We’ll add it.