Plural Forms

من ويكي عربآيز
اذهب إلى: تصفح، ابحث
Arabic.png

هذه الصفحة موجودة بالعربية تحت عنوان صيغ المعدود

GNU Gettext is used by most free software as a localization framework, one of GNU Getext features is plural forms.

Plurals

We are using now a 6 forms plural formula:

  • First form: for 0
  • Second form: for 1
  • Third form: for 2
  • Fourth form: for numbers that end with a number between 3 and 10 (like: 103, 1405, 23409).
  • Fifth form: for numbers that end with a number between 11 and 99 (like: 1099, 278).
  • Sixth form: for numbers above 100 ending with 0, 1 or 2 (like: 100, 232, 3001)

For Mozilla products (Firefox, Thunderbird, Sunbird, Fennec), the case where n == 0 is shifted to become the last case (due to some backward compatibility with the older plural rule).

Plural formula

This is the plural formula used for the forms above:

nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;


An exception for Mozilla products is:

nplurals=6; plural=n==0 ? 5 : n==1 ? 0 : n==2 ? 1 : n%100>=3 && n%100<=10 ? 2 : n%100>=11 ? 3 : 4;


Examples

msgid "1 Item"
msgid_plural "%d Items"
msgstr[0] "لا عناصر"
msgstr[1] "عنصر واحد"
msgstr[2] "عنصران"
msgstr[3] "%d عناصر"
msgstr[4] "%d عنصرا"
msgstr[5] "%d عنصر"


As for Mozilla:

 msgid "1 Item"
 msgid_plural "%d Items"
 msgstr[0] "عنصر واحد"
 msgstr[1] "عنصران"
 msgstr[2] "%d عناصر"
 msgstr[3] "%d عنصرا"
 msgstr[4] "%d عنصر"
 msgstr[5] "لا عناصر"