This method can be used to transfer overlays from an object. The keys are transferred and the values are entered as text.
The values can either be character strings or, in the case of texts with plural forms, objects. The plural forms must be stored as text via a standard key "zero", "one", "two", "few", "many" and "other".
Additionally, the key default can be specified, which will be used if no other key fits.
In some languages, like for example in german, there is no own more number at the value 0. In these languages the function applies additionally zero.
translations.assignTranslations({
"text1": "Make my day!",
"text2": "I'll be back!",
"text6": {
"zero": "There are no files on Disk.",
"one": "There is one file on Disk.",
"other": "There are files on Disk."
"default": "There are files on Disk."
});
A number count
can be passed to this method. In addition to a number, one of the keywords can also be passed directly.
"zero", "one", "two", "few", "many" and "other". Remember: not every language has all rules.
The appropriate text for this number is then selected. If no suitable key is found, defaultText
is taken.
Set a text for a key
translations.setText("text1": "Make my day!");
// plural rules
translations.setText("text6": {
"zero": "There are no files on Disk.",
"one": "There is one file on Disk.",
"other": "There are files on Disk."
"default": "There are files on Disk."
});