Closed elmar001 closed 1 year ago
Hi @elmar001,
Not sure what you mean by raw.
Have you found some docs that say arb files allow lists?
You are right. The current implementation does not support this.
However, the ICU Select kind of messages is similar. Maybe their usage can help you.
"selectExample1": "{choice, select, foo {Foo message} bar {Bar message} baz {Baz message} other {Other message}}",
"@selectExample1": {
"placeholders": {
"choice": {}
}
},
"selectExample2": "{option, select, opt1 {Option 1} opt2 {Option 2} opt3 {Option 3} other {Other}}",
"@selectExample2": {
"placeholders": {
"option": {}
}
}
Thanks @lzoran. WIth the word "raw" I mean localization implementation by l10n.yaml way without FLutter Intl. Here is the example: https://www.applanga.com/docs/formats/arb
So according your suggestion if I implement that way what key can I use? selectExample? Like this: S .of(context).selectExample?? But is is still not recognized as a key.
Update: Thanks, Turns out there is now way to use ready list as a key. So I'd need to create a list from the individiual keys where I need to use the list.
The Flutter Intl
and the gen_l10n
are two different approaches in Flutter localization.
Although they are different approaches, they work the same in the most cases, and the both are supported by the Localizely. Maybe this post can give you more info.
Regarding the provided docs, it looks like a different localization approach from the two mentioned at the beginning.
When it comes to the usage of the ICU Select kind of messages, you will need to pass the argument (string or enum) to access the proper localization message.
S.of(context).selectExample2('opt2')
Thanks. I needed it to assign to DropdownButton like below:
items: S
.of(context)
.myListKey
.map((value) {}
Thought there may be a way to use ready list directly from the .arb file definition. But seems like it is not possible and I need to create a list by assigning these values where I need to use it.
I'm glad if I was of help.
Closing this issue as resolved.
But seems like Flutter Intl implementation intl_en.arb file does not support it? Adding as above example does not work as the key appear to be unrecognized when I try to use. How is it supposed to be entered then?