📝Nested Texts
In the previous chapter we understood the basic structure for constructing texts, but sometimes we need to nest properties to construct our texts.
{
"texts": {
"txt_1": "Hi $1"
}
}
locale.translate('texts.txt_1', 'Guilherme');
// output: Hi Guilherme
We can access the properties of our object using the '.', so it is easier to structure deep objects.
{
"texts": {
"txt_1": {
"txt_2": "Hi $1"
}
}
}
locale.translate('texts.txt_1.txt_2', 'Guilherme');
// output: Hi Guilherme
With this you will be able to better organize the language properties.
Last updated