plural and arguments don't work in nested keys
Hi,
This doesn't work:
{
"category": {
"result": {
"zero": "You not have money",
"one": "You have {} dollar",
"many": "You have {} dollars",
"other": "You have {} dollars"
},
"total": "{} items"
}
}
Text('category_result').plural(Count)
Text('cateory_total').tr(args: [total]);
but if I remove the nested keys it works
{
"result": {
"zero": "You not have money",
"one": "You have {} dollar",
"many": "You have {} dollars",
"other": "You have {} dollars"
},
"total": "{} items"
}
Text('result').plural(Count)
Text('total').tr(args: [total]);
I'm using the 2 commands to generate the keys:
flutter pub run easy_localization:generate -S "assets/translations" -O "lib/translations"
flutter pub run easy_localization:generate -S "assets/translations" -O "lib/translations" -o "locale.keys.g.dart" -f keys
and I can see the keys being generated
abstract class LocaleKeys {
static const category_result = 'category.result';
static const category.total = 'category_total';
}
in the UI appears as category_result.many (not the translation)
Thanks for any help you can provide
update package and rerun your generator, i have difrent keys in my output
abstract class LocaleKeys {
static const category_result = 'category.result';
static const category_total = 'category.total';
static const category = 'category';
}
then you need get translation like this: Text(LocaleKeys.category_result.plural(Count)) Text(LocaleKeys.category_total).tr(args: [total]);
I have the latest package. I still have problems with using plural for nested keys. The workaround is just add those key to the root
Closing since we could not reproduce with the given code. @sasarivera please comment if the issue persists