Open morvael opened 3 months ago
For easier understanding of the code it could be so that the English text is the label id:
["FORMAT_STRING", "Second parameter is {1}, first parameter is {0}", "ABC", "DEF"]
"Second parameter is {1}, first parameter is {0}": {
"German": "Der zweite Parameter ist {1}, der erste Parameter ist {0}"
}
A function that takes a format string and variable number of parameters, inserted at indexed positions would be a godsend. It could also be a way to achieve localization of internally created messages, if the format string would be a label id.
Examples:
1)
["FORMAT_STRING", "Second parameter is {1}, first parameter is {0}", "ABC", "DEF"]
returnsSecond parameter is DEF, first parameter is ABC
string.2)
["FORMAT_STRING", "id:labelId", "ABC", "DEF"]
, system set to German language and the label as follows:returns
Der zweite Parameter ist DEF, der erste Parameter ist ABC
string.Parameters themselves could be also processed as labels but this isn't necessary as can be handled by some recursive use of FORMAT_STRING.