Custom Language Switcher

An alternative to the default language-switching widget.

If you choose not to display the default 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.

Language-based Subdirecties and Subdomains

  • If you are using language-based subdirectories on your website, you need to set the useSubdirectoriesWithWidget option to true in your Localize.initialize() call.
  • If you are using language-based subdomains on your website, you need to set the useSubdomainsWithWidget option to true in your Localize.initialize() call.

Gathering Feedback from Users

You can gather feedback on the quality of the translations on your website from your end-users by adding the Feedback option in your custom widget, or elsewhere on your website. When the user selects the Feedback option, call the showFeedback()method using JavaScript:

<div onclick="window.Localize.showFeedback()">Feedback</div>

Read how to use this feature in the Feedback Option in the Widget help doc.