From 0cd016741dd57b10f974756b30c9ba8b5d537d08 Mon Sep 17 00:00:00 2001
From: Elliott Hughes
All strings are capable of applying some styling markup and formatting arguments. For @@ -231,10 +230,19 @@ so Android provides you with methods such as {@link android.content.res.Resources#getQuantityString(int,int) getQuantityString()} to select the appropriate resource for you. -
Note that the selection is made based on grammatical necessity. A string for zero
-in English will be ignored even if the quantity is 0, because 0 isn't grammatically different
-from 2, or any other number except 1 ("zero books", "one book", "two books", and so on).
-Don't be misled either by the fact that, say, two sounds like it could only apply to
+
Although historically called "quantity strings" (and still called that in API), quantity
+strings should only be used for plurals. It would be a mistake to use quantity strings to
+implement something like Gmail's "Inbox" versus "Inbox (12)" when there are unread messages, for
+example. It might seem convenient to use quantity strings instead of an {@code if} statement,
+but it's important to note that some languages (such as Chinese) don't make these grammatical
+distinctions at all, so you'll always get the other string.
+
+
The selection of which string to use is made solely based on grammatical necessity.
+In English, a string for zero will be ignored even if the quantity is 0, because 0
+isn't grammatically different from 2, or any other number except 1 ("zero books", "one book",
+"two books", and so on).
+
+
Don't be misled either by the fact that, say, two sounds like it could only apply to
the quantity 2: a language may require that 2, 12, 102 (and so on) are all treated like one
another but differently to other quantities. Rely on your translator to know what distinctions
their language actually insists upon.
@@ -313,7 +321,7 @@ values, with non-exhaustive examples in parentheses: