summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-20 00:27:29 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-20 00:27:29 +0000
commit6973a63e967a8c913afa603b312ec9516f19d4fb (patch)
tree6f8947ebdda8f17da26076efd9b4341b1a7055e1 /docs
parent77fe4c96b75550e5d22a294314b05beabd55e97a (diff)
parentec2d8d0bb8a36355b8d687c660b5c64e4aebd9b8 (diff)
downloadframeworks_base-6973a63e967a8c913afa603b312ec9516f19d4fb.zip
frameworks_base-6973a63e967a8c913afa603b312ec9516f19d4fb.tar.gz
frameworks_base-6973a63e967a8c913afa603b312ec9516f19d4fb.tar.bz2
am ec2d8d0b: am ea8ff822: Merge "Fix and be more explicit about plurals best practices."
* commit 'ec2d8d0bb8a36355b8d687c660b5c64e4aebd9b8': Fix and be more explicit about plurals best practices.
Diffstat (limited to 'docs')
-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>