Cannot enter number placeholder for a plural form

I am trying to translate an Android app to Ukrainian but I am facing an issue with plural forms. transifex prevents me from using the number placeholder because in the original text one of the forms omits it.

The text in question:

<plurals name="bulk_notes_deleted">
    <item quantity="one">Deleted one note</item>
    <item quantity="other">Deleted %1$d notes</item>
</plurals>

(notice that form “one” does not have the placeholder)

The translation I need to enter should look like this:

<plurals name="bulk_notes_deleted">
    <item quantity="one">Вилучено %d нотатку</item>
    <item quantity="few">Вилучено %d нотатки</item>
    <item quantity="many">Вилучено %d нотаток</item>
    <item quantity="other">Вилучено %d нотатки</item>
</plurals>

(notice that the first form does have the placeholder. It needs it because it will also handle numbers like 1, 21, 101)
However, there is no way to insert the placeholder for form “one”. I managed to copy it from another translation but transifex refuses to save the translation as it not present in the original text.

Hello kotyhoroshko,

I am Antonis from the Transifex support team.

Regarding your issue, Transifex follows CLDR rules, and I will share below an image of how plural rules work in Ukrainian, just for reference.

As you can see for, the form of “one” 1, 21, 31, etc. is included in that same form. As a result, that means that in the source string, “one” should be replaced with a variable such as %d. We recommend this practice so that you will be able to handle all the other numbers that follow this rule.

This is also true for other languages that handle more than one number in the singular form (for example French where the singular form is used for a count of 0 and 1).

Please let me know if this helps solve your issue or if I missed anything, and I will get back to you as soon as possible.

Kind regards,

Antonis

Hello Antonis,

Thank you for your quick reply!

Thanks, this could help me resolve the problem and Android documentation confirms that. Maybe I will go with that by asking the owner to change the source text. But, to be honest, this does not feel completely right to me:

  1. Despite the documentation, Android OS itself has an instance of omitting the variable for singular form in default translation but using the variable in the translated string: source, translated. (I found it on my phone in Wi-Fi settings, and it seems to display correctly :smiley:). So, I would not consider that outright invalid.
  2. I would guess there might be additional problems would someone try to import those files into Transifex. It might fail during the import or refuse to save the translation with the same error as I am getting now.
  3. Being able to have “Deleted one note” (instead of “Deleted 1 note”) for the English version looks like a valid and useful case to me.
  4. The logic by which Transifex decides that I cannot use the variable %d for singular form seems a bit strange to me:
    4.1 I am disallowed to use %d in translation for the singular form because the singular of the source string does not use it. But why does Transifex look at “one” category specifically? The same category in two different languages, as you have mentioned, is not necessarily equivalent. At the same time, I am allowed to use %d in translations for “few” and “many” categories even though these categories are not in the source at all.
    4.2 I would assume that the set of variables is actually the same for all plural forms of a string. It is just that not every variable has to be used in every plural form. (So, %d in my examples is always available, but sometimes ignored)

If I got it right, you may consider this change: if a variable is used in one plural form of a string, it should be available for use in all the forms.

Sorry for off topic but my actual reply has been hidden by the spam filter for one week.

Hello kotyhoroshko,

Thank you for taking the time to offer your feedback!

This is possible if you edit this specific translation check for the XML file type. I will share a screenshot below explaining exactly how to do that:

First, go to your organization settings, and in the translation checks section, navigate to “Android String Resources (.xml) checks”. In the drop-down, you can find the “Variable substitution specifiers (like “%s”) are preserved in the translations” check, which will be set to produce an error. You can change that to a warning and then hit save.

This will allow you to have “one” in the source string while using a variable in the translation, as seen below:

You will still get a warning, but now you can save the translation normally.

Please let me know if this helped solve your issue and if anything else comes up, let me know, and I will get back to you as soon as possible.

Kind regards,

Antonis