Multilanguage support
Dynamic forms can support any language.
The lower section of the form configuration contains translations in every available language. (File and directory structure)
Default messages are available in Polish and English. If you want, you can add your own language.
Each form must contain a "translations" section.
{
...
"translations": {
"en": {
"Alert -Validate-Success- confirmButtonText": "Send",
"Alert -Validate-Success- title": "Your form is correct!",
"Alert -Validate-Success- text": "Now you can send the form or correct.",
"Alert -Validate-Success- showForm": "Show form",
"Alert -Send-Success- confirmButtonText": "Ok",
"Alert -Send-Success- title": "Success!",
"Alert -Send-Success- text": "Your form has been sent correctly!",
"Alert -Send-Error- confirmButtonText": "Ok",
"Alert -Send-Error- title": "Error!",
"Alert -Send-Error- text": "OTRS rejected the form!"
},
"pl": {
"Alert -Validate-Success- confirmButtonText": "Wyślij",
"Alert -Validate-Success- title": "Formularz został poprawnie wypełniony",
"Alert -Validate-Success- text": "Teraz możesz go wysłać lub poprawić.",
"Alert -Validate-Success- showForm": "Zobacz formularz",
"Alert -Send-Success- confirmButtonText": "Dobrze",
"Alert -Send-Success- title": "Udało się!",
"Alert -Send-Success- text": "Twój formularz został dostarczony!",
"Alert -Send-Error- confirmButtonText": "Dobrze",
"Alert -Send-Error- title": "Błąd!",
"Alert -Send-Error- text": "OTRS odrzucił formularz!"
}
}
}
We can add any number of translations to each section, we can also create our own section.
Each place in the dynamic form system that displays data can take 2 text formats:
- text
- {text}
Text Translation
If you want to enable the use of forms in multiple languages, you must do the following.
Enabling the language change button in the global settings
Go to SystemConfig.json configuration and set the parameter "ShowLangButton" to true. (Main configuration file - global settings)
If you want, you can also adjust the color here and set the default language.
Adding translations to the form file.
Now you just need to add translations to the form file. Below the last system translation ["Alert -Send-Error- text": "OTRS rejected the form!"], you can add your own translations.
Use of translations
If you want to use a translation, you just need to enter its key in the braces.
It will display "Your name", regardless of the selected language.
{
"label":"Your Name"
}
It will display the translation of "Your name" from the section with the currently loaded language.
{
"label":"{Your Name}"
}