WAI
Status Update
Comments
ji...@gmail.com <ji...@gmail.com> #2
I got a same issue, item quantity="zero" passes xml parser in eclipse but it's
actually not working.
I'd like to know valid values for "quantity". I couldn't find any reference about
this.
actually not working.
I'd like to know valid values for "quantity". I couldn't find any reference about
this.
so...@gmail.com <so...@gmail.com> #3
Source code is always the best place to find information! Read this:
http://www.google.com/codesearch/p#uX1GffpyOZk/core/java/android/content/res/PluralRules.java
Valid **parsing** values are: "zero", "one", "two", "few", "many", "other".
But the only **working** values are: "one" and "other" (and strangely "few" also if
your Locale is "cs")...
Valid **parsing** values are: "zero", "one", "two", "few", "many", "other".
But the only **working** values are: "one" and "other" (and strangely "few" also if
your Locale is "cs")...
ji...@gmail.com <ji...@gmail.com> #4
Thank you for your advice :-) That's a perfect example.
But I don't like the result that the Rule do not care of zero or something in locale
en. I think the plural rules mechanism is only for pure plural expressions, but verbal
expressions (ex. No items or Nothing).
(Is there a language has special grammar rule for zero?)
But I don't like the result that the Rule do not care of zero or something in locale
en. I think the plural rules mechanism is only for pure plural expressions, but verbal
expressions (ex. No items or Nothing).
(Is there a language has special grammar rule for zero?)
he...@gmail.com <he...@gmail.com> #5
As it is now getQuantity seems useless. Beware of the special rule for Czech (cs) which also requires "few". All languages should atleast have "zero", "one" and "other", defaulting to "other".
o....@gmail.com <o....@gmail.com> #6
I just discover this issue. It's very surprising that it's not fixed since may 2010... Plural forms are useless if we can't use a specific string for a zero value.
bl...@gmail.com <bl...@gmail.com> #7
Hmm, in sl locale (Slovenina) we also have special grammar rules for "two", "three" and "four"...
da...@gmail.com <da...@gmail.com> #8
Yes, according to gettext plural rules quantity=["zero" | "one" | "two" | "few" | "many" | "other"] is not enough for quite many languages
http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
el...@gmail.com <el...@gmail.com> #10
Per the documentation (http://developer.android.com/guide/topics/resources/string-resource.html ) it seems clear that this is not now the plural system is supposed to work.
It says that what "zero" or "one" etc. specifically mean depends on the language. In Russian, "one" means everything ending in 1 but not ending in 11. In English, "zero" has no meaning and is ignored. Don't expect this to be changed.
It says that what "zero" or "one" etc. specifically mean depends on the language. In Russian, "one" means everything ending in 1 but not ending in 11. In English, "zero" has no meaning and is ignored. Don't expect this to be changed.
[Deleted User] <[Deleted User]> #11
Can't believe this isn't fixed yet...
ro...@google.com <ro...@google.com> #12
The comments are correct, this is working as intended.
da...@gmail.com <da...@gmail.com> #13
The problem is not that the code is or isn't working as intended. The problem is that it is not working like grammar rules would require. In French, by example, we use the singular for a quantity between -2 (not included) and 2 (not included).
This is why there's no benefit in using Plurals in French applications and, from what is written in the comments, in a lot of other languages.
This is why there's no benefit in using Plurals in French applications and, from what is written in the comments, in a lot of other languages.
mo...@gmail.com <mo...@gmail.com> #14
If you i18n your app in my opinion for all the above reasons the only really useful ones are "one" and "other". Using anything else will result in trouble in one or more languages ;-)
mo...@gmail.com <mo...@gmail.com> #15
And if it work as intended as flagged by Roman Nurik... I would like to see an example app that actually is grammatically correct across the majority of languages used on the Play store..
dm...@gmail.com <dm...@gmail.com> #16
you can try this http://code.google.com/p/android-i18n-plurals/ -- provides correct behavior for many languages and option to treat 0 specially
al...@gmail.com <al...@gmail.com> #17
Is the quantity string support still broken in Android 2.3.3?
There is a note athttp://code.google.com/p/android-i18n-plurals/ that says that you only need this alternative support if your target platform is SDK 9 or lower—supposedly the quantity strings are fixed in API 10.
However I tried the API 10 and it's still broken there.
There is a note at
However I tried the API 10 and it's still broken there.
ma...@gmail.com <ma...@gmail.com> #18
@16 thanks. corrected.
cf...@gmail.com <cf...@gmail.com> #20
[zero, one, two, few, many, other] is the complete, and standard list for dealing with localizations.
these are grammatical categories, not values.
"one" in French, covers the number -1, 0, 1;
"one" in English, covers "1"
"one" in Portuguese, covers "1" and "0.1", "0.10", "0.001" ...
"zero" is a grammatical category in Latvian, 0 diennakšu, [one] 1 diennakts, [other] 2 diennaktis
Also, this seems to be resolved in API 11
these are grammatical categories, not values.
"one" in French, covers the number -1, 0, 1;
"one" in English, covers "1"
"one" in Portuguese, covers "1" and "0.1", "0.10", "0.001" ...
"zero" is a grammatical category in Latvian, 0 diennakšu, [one] 1 diennakts, [other] 2 diennaktis
Also, this seems to be resolved in API 11
ch...@orr.me.uk <ch...@orr.me.uk> #21
Read comment #7 and you'll see that "[zero, one, two, few, many, other]" is *not* sufficient to cover all languages.
el...@gmail.com <el...@gmail.com> #22
"[zero, one, two, few, many, other]" is 6 grammatical categories, so it would be enough to cover any language where nplurals <= 6 in the gettext system. As it happens, nplurals=6 is the largest number gettext seems to use, for Arabic (http://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html ).
bo...@gmail.com <bo...@gmail.com> #23
In french 0 and 1 are must be treated as singular, whereas plural must be used for other cases.
What syntax for <plurals> should I use to handle this?
If the answer is that it can't be handled, then I think this issue must be re opened.
What syntax for <plurals> should I use to handle this?
If the answer is that it can't be handled, then I think this issue must be re opened.
bo...@gmail.com <bo...@gmail.com> #25
Thanks, it appears it *does* work as expected indeed when using "one" for the 0 and 1 cases in french.
"one" can mean 0... Talk about a confusing api ;)
"one" can mean 0... Talk about a confusing api ;)
lb...@gmail.com <lb...@gmail.com> #26
Is there another official way to use strings according to quantity?
For now, I use this solution:
http://stackoverflow.com/a/5671704/878126
example:
<resources>
<string name="item_shop">{0,choice,0#No items|1#One item|1<{0} items}</string>
</resources>
textView.setText(MessageFormat.format(getText(R.string.item_shop), quantity));
For now, I use this solution:
example:
<resources>
<string name="item_shop">{0,choice,0#No items|1#One item|1<{0} items}</string>
</resources>
textView.setText(MessageFormat.format(getText(R.string.item_shop), quantity));
pk...@gmail.com <pk...@gmail.com> #27
More than 6 years later, this bug is still present in Android 7.1 Nougat...
da...@gmail.com <da...@gmail.com> #28
Should we create another bug that mention this one?
li...@gmail.com <li...@gmail.com> #29
This is not a bug; it is working as intended.
http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html
English doesn't make a grammatical distinction between 0 and 2. The only valid qualifiers for English is "one" and "other".
"zero", "two", "few", "many" are used for languages that has several different grammtical rules for plurals; this does not apply to English.
English doesn't make a grammatical distinction between 0 and 2. The only valid qualifiers for English is "one" and "other".
"zero", "two", "few", "many" are used for languages that has several different grammtical rules for plurals; this does not apply to English.
pf...@squareup.com <pf...@squareup.com> #30
Yes, this is working as intended (and defined by the spec), it's just not *useful* for what it looks like at first glance.
c9...@gmail.com <c9...@gmail.com> #31
this looks like a bug or the spec is not clear enough
in my case
I have Items, Items (5). I wanted to show Items (for zero items) and Items (x) for others.
in my case
I have Items, Items (5). I wanted to show Items (for zero items) and Items (x) for others.
al...@gmail.com <al...@gmail.com> #32
still not working correctly..
ho...@gmail.com <ho...@gmail.com> #33
They won't fix because this is intended behavior as they stated, but their intended behavior is buggy in this case.
to...@gmail.com <to...@gmail.com> #34
The "intended behavior" defence is BS. How about the simple example:
- "No chargepoints available" (0)
- "1 chargepoint available" (1)
- "2 chargepoints available" (2)
It's more natural in many cases to write "no xyz" instead of "0 xyz".
- "No chargepoints available" (0)
- "1 chargepoint available" (1)
- "2 chargepoints available" (2)
It's more natural in many cases to write "no xyz" instead of "0 xyz".
ta...@gmail.com <ta...@gmail.com> #35
That's an application logic you can implement very easily. It's just one if statement.
ja...@gmail.com <ja...@gmail.com> #36
PluralRules exists to help with the application logic necessary for plurals.
ta...@gmail.com <ta...@gmail.com> #37
Please check the above shared links in #22 and #29.
Android's behavior is based on a standard set by Unicode.
Android's behavior is based on a standard set by Unicode.
jj...@gmail.com <jj...@gmail.com> #38
What's the problem with fixing such simple thing? Why is it even part of XML's DTD if it's not working?
pf...@squareup.com <pf...@squareup.com> #40
It's working to the spec, it's just that the spec is not... useful in some practical ways.
de...@gmail.com <de...@gmail.com> #41
Hi, Any update on this issue? 10 year no progress
Description
"zero", "one", "few", "many" and "other" but it seems that only "one" and
"other" are effectively handled.
As a result, using Resources.getQuantityResource() with 0 as quantity will
never return the string declared in resources for quantity "zero".
example:
<plurals name="items">
<item quantity="zero">No items</item>
<item quantity="one">1 item</item>
<item quantity="other"><xliff:g id="count">%d</xliff:g> items</item>
</plurals>
System.out.println(getResources().getQuantityString(R.plurals.items, 0, 0));
-> "0 items"
expected:
-> "No items"