Multilingual content
Texts such as those used for the Labels can also be written in several languages.
Multilingualism can also be used in the state.
Each MULTI_LANGUAGE object is automatically translated into the current language.
The current language itself is stored in the state under language and can be changed by the user, for example, by using languageButton in the container.
The list of available languages is stored in the state under languageOptions.
German and English are supported by default.
MultiLanguageDefinition
The MULTI_LANGUAGE attribute indicates that a multilingual object is used.
A text can be stored in this object for each desired language.
The two-character ISO-639-1 code of the country serves as the attribute and the text for the corresponding language as the value.
If only monolingual texts are required, a simple string can be used as an alternative.
{
"type": "textfield",
"label": {
"MULTI_LANGUAGE" : {
"de": "deutsches Label",
"en": "englisch label"
}
}
},
{
"type": "textfield",
"label": "einsprachiges Label"
}
Example
{
"$schema": "https://forms.virtimo.net/5.1.0/schema.json",
"metaData": {
"id": 0,
"version": 0
},
"configuration": {
"defaultLanguage": "de"
},
"components": [
{
"type": "container",
"languageButton": true,
"label": {
"MULTI_LANGUAGE": {
"de": "Überschrift",
"en": "Headline"
}
},
"components": [
{
"type": "html",
"value": "${/data/text}"
},
{
"type": "combobox",
"options": "${/languageOptions}",
"value": "${/language}"
}
]
}
],
"state": {
"data": {
"text": {
"MULTI_LANGUAGE": {
"de": "Deutscher Text",
"en": "English text"
}
}
}
}
}