geting error/warning for plurals : “The quantity &

2020-06-16 01:32发布

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?

2条回答
做自己的国王
2楼-- · 2020-06-16 02:05

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 to %d to your one string and should be fine. Also make sure your translators respect the plural rules for their language.

查看更多
该账号已被封号
3楼-- · 2020-06-16 02:14

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.

查看更多
登录 后发表回答