When customizing the language switcher in HTML, a few aspects have to be considered in order to make the language switch work out of the box. Consider the following example:
To loop over all available languages, use the availableLanguages
macro. For each language, the following properties are available:
languageKey
: denotes the language key, e.g. "de"languageActive
: whether or not the language is the one currently being usedlanguageText
: the human-readable translation of the language. The text is inferred from a translation keygeneral.language.languageKey
, e.g. general.language.de
In order for the language switch to work properly, the following two constraints must be met as shown in the example above:
- The HTML element to be clicked by a user must have CSS class
iam-language-switcher-link
- The same element must have an attribute named data-lang with the value of languageKey.