Android plurals treatment of “zero”

前端 未结 6 1466
悲哀的现实
悲哀的现实 2020-12-04 08:38

If have the following plural ressource in my strings.xml:

   
        No item
           


        
6条回答
  •  盖世英雄少女心
    2020-12-04 09:04

    From http://developer.android.com/guide/topics/resources/string-resource.html#Plurals:

    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 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.

    In conclusion, 'zero' is only used for certain languages (same goes for 'two' 'few' etc.) because the other languages do not have a special conjugation and therefore the 'zero' field is considered unnecessary

提交回复
热议问题