Change Arabic plural forms formula

Asked by Khaled Hosny

The current plural forms formula in launchpad is "n == 1 ? 0 : n == 2 ? 1 : 2" which I haven't seen used any where before, and is wrong, and I believe it caused corruption of Gnome translations since upstream PO files were using different formula.
Arabic has more complicated plural forms. The formula that we (at Arabeyes.org) agreed on is "nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;".

We already switched to this formula in Gnome and KDE and other projects should follow. What is the possibility to change this in rosetta as well?

Question information

Language:
English Edit question
Status:
Answered
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Данило Шеган (danilo) said :
#1

We were not aware of this: this seems to be a fairly recent development. I see the discussion was started in mid-2006 (http://lists.arabeyes.org/archives/doc/2006/July/msg00217.html), and the decision later documented up on http://wiki.arabeyes.org/Plural_Forms (btw, this formula doesn't agree with the description given there: eg. when the number is 204, it will return 3, whereas the description suggests it should be 5/F).

Unfortunately, Launchpad provides a single plural form expression per language, trying to normalise any other cases that it can, and at the moment, it has a limitation of 4 plural forms per language (we actually went through a lot of PO files when changing this in October 2007, including Arabic GNOME PO files, and found no case with more than 4 plural forms, so we went with hardcoding this limit to improve performance).

Of course, if this is indeed the required number of plural forms for Arabic, we'll definitely adapt Launchpad Translations to support it.

Thus, I'd like to make sure that the above formula is indeed correct and to try to figure out any possible workarounds before we fix Launchpad. So, when looking at the example from the above wiki page, I wonder about the 0 and 2 cases: the words themselves seem to be spelled out the same, and the only difference is with how and where is the number spelled out. Could they also be worked-around using the E case, i.e. replacing %x with 0 and 2 (possibly using Arabic numerals if the locale is set up like that), respectively?

So, I am asking if we can use the following formula as a workaround until proper solution is put in place:
"nplurals=4; plural=n==1 ? 1 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 0 : 2;"

Revision history for this message
Khaled Hosny (khaledhosny) said :
#2

Yes this is relatively new, but the old 4 cases formula were wrong as well. We went through many discussions since mid 2006 until recently trying to figure out the correct formula, both lingually and from gettext perspective and we ended up with the formula I mentioned above. The wiki page wasn't updated for a while (the fact that we moved the discussion to an Arabic page and forgot to update the English one, I updated it now, so please look at it again.)

We already switched to this 6 cases formula for Gnome 2.22 (I'm in the process of fixing all entries manually) and KDE 4.x (KDE 3.x is using its own plural forms system not gettext).

The old 4 cases formula doesn't address 0 case (which should be handled specially) nor 11-99 numbers, and isn't based on any clear lingual rules.

Revision history for this message
Jeroen T. Vermeulen (jtv) said :
#3

The 1.2.3 rollout adds support for up to 6 plural forms. At that point we can start using the new formula in Launchpad.

Can you help with this problem?

Provide an answer of your own, or ask Khaled Hosny for more information if necessary.

To post a message you must log in.