Custom language switcher
An alternative to the Widget.
If you choose not to display the language widget, you'll need a way to allow your visitors to switch between available languages. Language links help switch the language of the site dynamically, with minimal setup required and full flexibility.
(not applicable in Mobile App projects)
Creating a link to switch languages
Create a link with the href
as follows: javascript:Localize.setLanguage('xx')
<a href='javascript:Localize.setLanguage("xx")'>LANGUAGE_NAME</a>
Replace "xx" with the language code identifier and LANGUAGE_NAME with the name of the language.
<a href='javascript:Localize.setLanguage("en")'>English</a>
Continue that process for the remainder of your languages.
Set the language with Javascript
Alternatively, you can set the language of the page in Javascript.
Localize.setLanguage('xx');
Replace "xx" with the language code identifier.
Updated over 3 years ago