Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

geting error/warning for plurals : "The quantity 'one' matches more than one specific number..."

Background

I work on an app that has many translations inside it.

I have the next English plural strings:

<plurals name="something">
    <item quantity="one">added photo</item>
    <item quantity="other">added %d photos</item>
</plurals>

and the French translation:

<plurals name="something">
    <item quantity="one">a ajouté une photo</item>
    <item quantity="other">a ajouté %d photos</item>
</plurals>

The problem

For both the French and Russian, I get the next warning:

The quantity 'one' matches more than one specific number in this locale, but the message did not include a formatting argument (such as %d). This is usually an internationalization error. See full issue explanation for more.

when choosing to show details , it says: enter image description here

Thins is, I don't get what should be done to fix it, and if there is even a problem...

The question

What exactly should I do with those strings? What should I tell the translators?

like image 400
android developer Avatar asked Oct 02 '14 11:10

android developer


2 Answers

In French singular form is used when count is 0 or 1. In English singular form is used only when count is 1. 0 uses a plural form.

This is why you need to insert a placeholder (%d) in your French singular pattern.

like image 175
Jaska Avatar answered Nov 15 '22 21:11

Jaska


I'm going to write an answer since this is quite an difficult explanation.

In various languages, nouns use the singular form if they end with 1. Refer to: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html

Explaining in English there are languages where it's correct to say "added 1 photo" as well as "added 101 photo". Notice the "photo". So this means that you should always add "%d" on one strings as well. Android will choose the best scenario to use. Which means that in English it will choose "other" for numbers > 1 and on other languages it will choose "one" for numbers ended in one.

Resuming, add %d to your one string and should be fine. Also make sure your translators respect the plural rules for their language.

like image 22
Pedro Oliveira Avatar answered Nov 15 '22 20:11

Pedro Oliveira