when translating software using gettext one has to pay attention to plurals, languages differ in how they treat singular and plural forms, gettext tries to be as accomodating as possible by allowing arbitirary rules for each language.
I suppose the rules of plural in arabic are well known enough and it is time we came up with a standard gettext expression to put as a header in all our po files.
so how to express this lovely pattern in the C like expression needed for PO files?
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) || (n % 100 == 1) || (n % 100 ==2) ? 4 :
5;
pretty isn't it? time to review the whole language me thinks, anyways.
if you're not using kbabel you can edit the header manualy, open the po file in a text editor, find the plural form line and change it to look like this
"Plural-Forms: 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) || (n % 100==1) || (n % 100==2) ? 4 : 5;\n"
The cases are actually five, as zero and three-to-nine use the same form of plural, but since لا تعليقات has more meaning in Arabic than صفر تعليقات, I thought they could be separated.