Apps-android-commons: zero quantity in messages doesn't work in English

Created on 15 Dec 2016  路  10Comments  路  Source: commons-app/apps-android-commons

Hi,

I've been translating the app into Hebrew at translatewiki. I didn't actually try running yet, so this whole issue might be wrong, but I'm pretty sure that the "zero" quantity in English plurals doesn't work. The quantity identifiers for different languages are based on their grammar, and since zero in English is the same as "other" (i.e. anything other than "one"), "zero" is not a valid string for English.

Furthermore, translatable strings Android apps don't support specific quantities, like MediaWiki does (again, this is AFAIK, and I might be wrong鈥擨'm not an Android expert).

The only string that I find with "zero" at the moment is contributions_subtitle.

To make it actually work as intended, it probably has to be rewritten with a condition.

bug localization

All 10 comments

I think we are talking about:

  <plurals name="contributions_subtitle">
    <item quantity="zero">No uploads yet</item>
    <item quantity="one">1 upload</item>
    <item quantity="other">%d uploads</item>
  </plurals>

(from app/src/main/res/values/strings.xml)

And yes, it appears that the "zero" rule is not used for the value 0 in English.

screenshot_1489888493

@whym I am picking this up. Creating a PR for the same

PR created for this issue

546

The PR looks good, but what can be done for languages other than English? There seems to be several approaches. Which is the best?

  1. Detect if the current locale has the notion of "zero" somehow. To do this, do we have to hardcode the applicable locale names?
  2. Drop the "zero" strings altogether. I believe this how it is done in the Wikipedia app (There is no 'quantity="zero"' in the repository.) However, is it unacceptable for languages like Arabic?
  3. Keep it as it is. Tell to the translator that the "zero" strings are not used in some (most?) languages including English, and that they can be skipped if that is the case. We can use /qq strings for this.

quantity="zero" shouldn't be in the English strings.xml at all, and there shouldn't be a need to check for the locale.

The question is whether you want special handling for zero at all. In English, the word "files" is the same in "0 files" and "5 files". Can it simply be "0 files", or is it important for you to say "No uploads yet"? If it's not important, just remove the condition.

It looks like the solution #546 is not working well.

Translators are seeing strings like this as the source text which can be cryptic.
{{PLURAL|zero=@string/contributions_subtitle_zero|one=%d upload|%d uploads}}
https://translatewiki.net/w/i.php?title=Wikimedia:Commons-android-strings-contributions_subtitle/en&diff=prev&oldid=7378080

I encountered a problem here. [[Wikimedia:Commons-android-strings-contributions subtitle/uk]] cannot be updated since the last change in English source in 2018. The system doesn't allow me to save an edit with |zero= in it.

Translators are still unable to translate this message: https://phabricator.wikimedia.org/T267142

Seems like the case for the string "contributions_subtitle". Should be probably simpler to remove the plural item for the quantity "zero" and handle it via branch statements instead of from the strings, raising a PR soon

@Nikerabbit , we have merged a fix, please let us know if the problem still occurs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

domdomegg picture domdomegg  路  3Comments

Saral-code picture Saral-code  路  3Comments

neslihanturan picture neslihanturan  路  3Comments

maskaravivek picture maskaravivek  路  3Comments

nicolas-raoul picture nicolas-raoul  路  3Comments