Page MenuHomePhabricator

Some strings were altered automatically, plural and grammar are broken
Open, Needs TriagePublicBUG REPORT

Description

This string used to represent the plurals correctly, now the "few/many" part is missing and the parameter was added to the "two" part:
https://translatewiki.net/w/i.php?title=Wikimedia:Wikipedia-android-strings-diff_years/he&diff=next&oldid=7662873

This one replaced the GRAMMAR:תחילית (auto prefix in Hebrew) with a space:
https://translatewiki.net/w/i.php?title=Wikimedia:Wikipedia-android-strings-top_on_this_day/he&diff=next&oldid=7875308

Event Timeline

YaronSh created this task.May 4 2019, 5:28 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 4 2019, 5:28 AM

I'm not sure when did this happen. I'm having a hard time even finding it in the Git history. This definitely doesn't look right, however.

As I'm searching for when did this happen in the Git history, I'm finding more problematic commits, such as this: https://github.com/wikimedia/apps-android-wikipedia/commit/dbccd0ce3fa3ad8b71bdd725b97a8352bcddd6b4 . It adds number parameters to strings where the number is already written as a word. Some languages, such as Hebrew and others, need to have words and not digits in some cases. It's probably related a different issue, but this points at a similar practice of editing translations in source files to fix bugs. This is not the right way to do it. Translations must only be edited at translatewiki.net. If translations cause tests to fail, then it's quite possible that the tests must be fixed and not the translations. If the translations really do need fixing, the right way to do is not to edit the source files, which should be managed by translatewiki, but to notify the translators or to mark the translations as !!FUZZY!!.

Hi @YaronSh and @Amire80

The Android XML does not support the wikitext format, which texts contain the double parentheses, such as {{PLURAL|one=Last year|%d years ago}}.

If a string item in the en/strings.xml contains a parameter %d, the other language should also have the parameter as well, otherwise it will lead the app crash when it tries to load the text with value.

Hi @YaronSh and @Amire80
The Android XML does not support the wikitext format, which texts contain the double parentheses, such as {{PLURAL|one=Last year|%d years ago}}.

Is the plural format for Wikimedia Android apps documented anywhere?

If a string item in the en/strings.xml contains a parameter %d, the other language should also have the parameter as well, otherwise it will lead the app crash when it tries to load the text with value.

Is it should or must? Some languages in some cases shouldn't have the number (%d) there. One example is Hebrew, where writing the number 1 as a digit is often bad and unreadable, and "one" should be written as a word. This may happen in other languages, too.

Hi @YaronSh and @Amire80
The Android XML does not support the wikitext format, which texts contain the double parentheses, such as {{PLURAL|one=Last year|%d years ago}}.

Is the plural format for Wikimedia Android apps documented anywhere?

In Android app, the plural format should be setup as the following format:

<plurals name="wikipedia_languages_remove_dialog_title">
    <item quantity="one">Remove selected language?</item>
    <item quantity="other">Remove selected languages?</item>
</plurals>

https://developer.android.com/guide/topics/resources/string-resource#Plurals

Do you think it would be better if we add all plural formats in the default XML for other languages?

<plurals name="wikipedia_languages_remove_dialog_title">
    <item quantity="zero"></item>
    <item quantity="one">Remove selected language?</item>
    <item quantity="two">Remove selected languages?</item>
    <item quantity="few">Remove selected languages?</item>
    <item quantity="many">Remove selected languages?</item>
    <item quantity="other">Remove selected languages?</item>
</plurals>

If a string item in the en/strings.xml contains a parameter %d, the other language should also have the parameter as well, otherwise it will lead the app crash when it tries to load the text with value.

Is it should or must? Some languages in some cases shouldn't have the number (%d) there. One example is Hebrew, where writing the number 1 as a digit is often bad and unreadable, and "one" should be written as a word. This may happen in other languages, too.

Sorry I didn't mention clearly. It must contain the parameters if the en/strings.xml has them. If we really want to resolve the unreadable issue, we will need special logic to handle it.

Aklapper added a comment.EditedMay 7 2019, 12:41 PM
<plurals name="wikipedia_languages_remove_dialog_title">
    <item quantity="one">Remove selected language?</item>
    <item quantity="other">Remove selected languages?</item>
</plurals>

if (x == 1) ... else ... does not work for languages that have more than one plural form.

<plurals name="wikipedia_languages_remove_dialog_title">
    <item quantity="zero"></item>
    <item quantity="one">Remove selected language?</item>
    <item quantity="two">Remove selected languages?</item>
    <item quantity="few">Remove selected languages?</item>
    <item quantity="many">Remove selected languages?</item>
    <item quantity="other">Remove selected languages?</item>
</plurals>

I don't see how that works for Slovenian for example, where 1, 101, 201, ... use the same singular form one; while 2, 102, 202, ... use the same plural form two; while 3, 103, 203, ... use the same plural form three; and other numbers use the plural form many.
(For English speakers: It's similar to ordinal numbers in English: 1st, 2nd, 3rd, Xth, 21st, 22nd, 23rd, ....)
Also see https://translatewiki.net/wiki/Plural