Multilingual Content

Text, such as that used for Labels, can also be written in multiple languages.

Multilingual support is also available in the state. Here, every MULTI_LANGUAGE object is automatically translated into the current language. The current language itself is stored in the state at language and can be changed by the user, for example, by using the languageButton in the container. The list of available languages is stored in the state at languageOptions. By default, German and English are supported.

MultiLanguageDefinition

The attribute MULTI_LANGUAGE indicates that a multilingual object is being used. In this object, you can store text for any desired language. The two-letter ISO-639-1 code of the country serves as the attribute, and the text for the corresponding language serves as the value. If only monolingual texts are needed, a simple string can be used instead.

Example
{
  "type": "textfield",
  "label": {
    "MULTI_LANGUAGE" : {
      "de": "deutsches Label",
      "en": "englisch label"
    }
  }
},
{
  "type": "textfield",
  "label": "einsprachiges Label"
}

Example

multipleLanguages.json
{
  "$schema": "https://forms.virtimo.net/5.0.x/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"
        }
      }
    }
  }
}
Embedded preview

Keywords: