Language Switcher Code - where to find?


Hello Developers community,

I created an own language switcher (and no, it was not possible to bring this design to the existing switcher) and I would like to know which code is implemented in the original switcher template so I can get the rewrite function of the URL to the other language.

Thank you very much for any help!


Hi @patrickhummel,

You can replicate the behavior of the language switcher module by setting window.location to the page URL with the language slug of the selected language. Each language version of a page is just the domain, a language slug (or for your primary language, no slug) and the page path. For example, if your primary language is English and your english page is, you can switch to the French version of your page by setting window.location to


Hi Derek,

this is not the behavior I am searching. I am searching for the link or the PHP code generated to switch to the other language. I have an a-tag and I will put just a link in it to swith to the only different language fr-ch. From de to fr-ch.

I set as link but nothing happened.