In my Flutter application I have multiple different languages, I use JSON (arb files) for localization (translation).
I have a widget with a variable number of cards and to fill the textual content of the cards I (ab)use the ICU Select
option, as suggested here, like this:
"card": "{choice, select, 0{Text 0.} 1{Text 1.} 2{Text 2.} 3{Text 3.} other{}}",
"@card": {
"placeholders": {
"choice": {}
}
},
I need to know the length of the Select
, to know how many cards to create (4 in the example code).
And I need to read it from the Select
because it varies depending on the fields and potentially even depending on the language.
I could put the total in other
but the text files will be filled by other people, so I don’t want there to be conflicts and I want to make sure I always read the actual content.
How can I read the Select
length?
Or is there a smarter way to handle messages in this case?
Thanks in advance!