summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-20 00:19:44 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-11-20 00:19:45 +0000
commitea8ff822121cde16344ba2db194a5f17283fa740 (patch)
treee69a357df9f0fee4624a14ab2a117cce47f89b4d
parent36c7f4b67326bad547f16aa6e72140bd839ab28d (diff)
parent1fe7d496db1ddc73289e6aae11f4dd4a970141d5 (diff)
downloadframeworks_base-ea8ff822121cde16344ba2db194a5f17283fa740.zip
frameworks_base-ea8ff822121cde16344ba2db194a5f17283fa740.tar.gz
frameworks_base-ea8ff822121cde16344ba2db194a5f17283fa740.tar.bz2
Merge "Fix and be more explicit about plurals best practices."
-rw-r--r--docs/html/guide/topics/resources/string-resource.jd16
1 files changed, 12 insertions, 4 deletions
diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd
index e2326ec..cbfa82e 100644
--- a/docs/html/guide/topics/resources/string-resource.jd
+++ b/docs/html/guide/topics/resources/string-resource.jd
@@ -237,7 +237,8 @@ distinctions at all, so you'll always get the <code>other</code> string.
<p>The selection of which string to use is made solely based on grammatical <i>necessity</i>.
In English, a string for <code>zero</code> 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).
+"two books", and so on). Conversely, in Korean <i>only</i> the <code>other</code> string will
+ever be used.
<p>Don't be misled either by the fact that, say, <code>two</code> 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
@@ -343,7 +344,14 @@ values, with non-exhaustive examples in parentheses:
&lt;?xml version="1.0" encoding="utf-8"?>
&lt;resources>
&lt;plurals name="numberOfSongsAvailable">
- &lt;item quantity="one">One song found.&lt;/item>
+ &lt;!--
+ As a developer, you should always supply "one" and "other"
+ strings. Your translators will know which strings are actually
+ needed for their language. Always include %d in "one" because
+ translators will need to use %d for languages where "one"
+ doesn't mean 1 (as explained above).
+ -->
+ &lt;item quantity="one">%d song found.&lt;/item>
&lt;item quantity="other">%d songs found.&lt;/item>
&lt;/plurals>
&lt;/resources>
@@ -353,7 +361,7 @@ values, with non-exhaustive examples in parentheses:
&lt;?xml version="1.0" encoding="utf-8"?>
&lt;resources>
&lt;plurals name="numberOfSongsAvailable">
- &lt;item quantity="one">Znaleziono jedn&#x0105; piosenk&#x0119;.&lt;/item>
+ &lt;item quantity="one">Znaleziono %d piosenk&#x0119;.&lt;/item>
&lt;item quantity="few">Znaleziono %d piosenki.&lt;/item>
&lt;item quantity="other">Znaleziono %d piosenek.&lt;/item>
&lt;/plurals>
@@ -597,4 +605,4 @@ with different types of styling applied to individual words:
// and bold the entire sequence.
CharSequence text = bold(italic(res.getString(R.string.hello)),
color(Color.RED, res.getString(R.string.world)));
-</pre> \ No newline at end of file
+</pre>