【发布时间】:2013-06-20 02:56:27
【问题描述】:
我使用plurals 为Android 应用程序编译一个数量字符串。我完全按照教程中可以找到的内容进行操作:
res.getQuantityString(
R.plurals.number_of_comments, commentsCount, commentsCount);
这里是复数的定义:
<?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>
有趣的是,输出字符串与我定义的很奇怪:
commentsCount = 0 => "0 comments"
commentsCount = 1 => "One comment"
commentsCount = 2 => "2 comments"
我猜这是因为文档将When the language requires special treatment of the number 0 (as in Arabic). 声明为zero 数量。有什么方法可以强制我的定义?
【问题讨论】:
标签: android android-xml android-resources plural