📝Serialization options
You can pass additional options in the arguments to perform text transformations.
{
"hello": "$1",
}
locale.translate('hello', 'niro you are cool.yesuppercase');
// output: NIRO YOU ARE COOL
.yesuppercase - Returns the value of the original string converted to uppercase.
.yeslowercase - Returns the value of the original string converted to lowercase.
.yestrim - Removes the leading and trailing whitespace.
.space[count] - Add x spaces to the end of the text.
.repeat[count] - Repeat x times the value.
locale.translate('hello', 'Repeat this .repeat[2]');
// output: Repeat this Repeat this
You can use the options in inheritance nesting
{
"hello": "$1",
"speak": "Thanks for use!",
}
locale.translate('hello', '.speak.space[1].repeat[2]');
// output: Thanks for use! Thanks for use!
With this you are able to change every aspect of your text.
Last updated