英文:
Flutter package easy_localization plurals not working as expected
问题
Using the package easy_localization for my apps translations. As an example here is the translations file json:
{"test": {
"zero": "zero",
"one": "one",
"two": "two",
"few": "few",
"many": "many",
"other": "other"},}
If I then simple print these to the console like so:
print(plural("test", 0));
print(plural("test", 1));
print(plural("test", 2));
print(plural("test", 3));
print(plural("test", 4));
it will return
zero
one
two
other
other
So it works for "zero", "one", "two" as expected. But then skips "few" and "many" and defaults to "other".
What constitutes "few" and "many"? Am I to take "other" as being used for plurals and ignore "few" and "many"?
There's no errors so I am not sure if this was the intended functionality. Feels wrong to me.
If anyone has had experience with this package, would be great if they could explain the reasoning for this.
英文:
Using the package easy_localization for my apps translations. As an example here is the translations file json:
{"test": {
"zero": "zero",
"one": "one",
"two": "two",
"few": "few",
"many": "many",
"other": "other"},}
If I then simple print these to the console like so:
print(plural("test", 0));
print(plural("test", 1));
print(plural("test", 2));
print(plural("test", 3));
print(plural("test", 4));
it will return
zero
one
two
other
other
So it works for "zero", "one", "two" as expected. But then skips "few" and "many" and defaults to "other".
What constitutes "few" and "many"? Am I to take "other" as being used for plurals and ignore "few" and "many"?
There's no errors so I am not sure if this was the intended functionality. Feels wrong to me.
If anyone has had experience with this package, would be great if they could explain the reasoning for this.
答案1
得分: 1
你可以在它们的源代码中查看复数规则是什么。
似乎大多数语言都有非常简单的复数规则。就像英语一样,基本上是没有、一个或其他:你可以说“没有钱”、“一美元”或“X美元”。英语没有针对其他数量的特殊语言。
恐怕我不知道任何具有特殊数量规则的语言。但如果你不得不为它们翻译,讲这种语言的人肯定会知道。
英文:
You can see what the plural rules are in their source code.
It seems most languages have very simple plural rules. Like English, where it's basically none, one or other: You can have "no money" "a dollar" or "X dollars". English does not have special language for other amounts.
I'm afraid I don't know any of the languages that do have special rules for special amounts. But if you ever have to translate for them, the person speaking the language will know for sure.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论