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.
different classes of numbers in arabic
- 0
- 1
- 2
- 3-10 + (100^n) : n >= 0
- 11-99 + (100^n) : n >= 0 or 1,2 + (100^n) : n >= 1
- 100^n : n >= 1
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 using kbabel
- go to settings -> configure kbabel
- and make Number of singluar/plural forms equal 5
- then in the GNU plural form header add the expression above
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"
example
- 0 -> لا تعليقات
- 1 -> تعليق واحد
- 2 -> تعليقان
- 3 -> تعليقات
- 4 -> تعليقا
- 5 -> ???
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.
- Printer-friendly version
- Login or register to post comments
- 1860 reads


تعليق واحد
What is the linguistic rule that made 1,2 + (100^n) : n >= 1 included with the fifth case?
I did another suggestion based on reading numbers from the right to the left. http://lists.arabeyes.org/archives/doc/2006/July/msg00217.html
For the samples: لا تعليقات تعليق واحد تعليقان تعليقات تعليقا تعليق
< and > symbols doesn't
< and > symbols doesn't appear properly in the page, see the farmula
My blog