$source.internationalize(
sourceLang: $sourceLang,
translate: $translate
)
Converts text in a given language into an internationalized string.
{"en": $englishText, "de": $germanText}
.internationalize(translate: $translate)
Combines text in multiple languages into one internationalized string.
| Name | Type | Description | Mandatory | Default |
|---|---|---|---|---|
| input | String or dictionary with strings | Either the simple string to be converted, or a dictionary that maps language abbreviations to texts in the respective language. | yes | |
| sourceLang | String | The language of the input string. Only relevant in the form with the single string as input. | no | The default language of the application |
| translate | Truth value | Whether to use the translation service to fill in the missing translations. If not all languages supported by the application have been specified for the construction of the internationalized string, and translation should not be used (or the translation service does not support all languages of the application) an internationalized string will be created, which will be displayed in the default language for some languages. | no | false |
Type: Internationalized string (tl.model.i18n:I18NString)
A value that can be displayed in the language of the logged in user. The input texts are combined to an internationalized string and optionally supplemented by generated translations of the translation service.
Turn the English text "Hello world!" into an internationalized string (tl.model.i18n:I18NString). Populate the remaining languages supported by the application with translations generated by the translation service:
"Hello world".internationalize(lang:"en", translate: true)
Returns a value that would be rendered as "Hello world!" for a user with the language German.
{"en": "Hello world!", "de": "Hallo Welt!"}.internationalize()
Returns the same as the TL Script literal #("Hello world!"@en, "Hallo Welt!"@de) but can be used with dynamic values.