I use plurals to compile a quantity string for an Android application. I follow exactly what one can find in the tutorials:
res.getQuantityString(
R.plurals.number_of_comments, commentsCount, commentsCount);
Here is the definition of the plurals:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="number_of_comments">
<item quantity="zero">No comments</item>
<item quantity="one">One comment</item>
<item quantity="other">%d comments</item>
</plurals>
</resources>
Interesting enough, the output string is odd to what I definied:
commentsCount = 0 => "0 comments"
commentsCount = 1 => "One comment"
commentsCount = 2 => "2 comments"
I guess this is because the docs state When the language requires special treatment of the number 0 (as in Arabic).
for zero
quantity. Is there any way to force my definition?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…