[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plural-Forms header



On Yaum al-Jumma 05 Jumaada al-Thaani 1425 05:56 pm, Abdulaziz Al-Arfaj wrote:

> > How can just inserting a header in a text file change the file?! Do I
> > need to
> > insert this header in each .po?! I thought this header should be
> > somewhere
> > built into the sources (.cpp or .h files) of KDE, GNOME, debian
> > installer, ... not in the .po files themselves, no?
>
> Its magic ;)
> Seriously, every language needs a specific header for it to handle the
> plurals. You don't need to insert this header into every file. Just in
> the files that have plural forms. It makes no sense to put these
> headers in the source files, because you would have to insert one
> header for EVERY language. Better to put it in a .po so it could be
> language specific.

What?!  Is it better to insert one header for each language once and forever 
or to have every translator to put a header each time in all .po that 
contains plurals for each language with every new file until he dies ;) 
Anyway, I checked the sources and found what I am looking for:

klocale.cpp:

  case 11: // Arabic
    EXPECT_LENGTH( 4 );
    if (n == 1)
      return put_n_in(forms[0], n);
    else if (n == 2)
      return put_n_in(forms[1], n);
    else if ( n < 11)
      return put_n_in(forms[2], n);
    else
      return put_n_in(forms[3], n);

So keep in mind any changes we suggest should be reflected here. This would 
break the existing plural translation so we need to solve this once and for 
ever.

> ==============================================
> My proposal: six plural forms!
>
> nplurals = 6; plural = n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100==1 ||
> n%100 ? 3 : n%100>2 && n%100<=10 ? 4 : 5
>
> Lets imagine we were talking about cats. Here is what you would put in
> the translation file under each tab in kbabel:
>
> [0]: و لا قطة
Keep in mind the context here. I have killed %n cats during my life would 
yield a wrong translation with n=0 per you suggestion.
أنا قتلت ولا قطة في حياتي؟! تعتبر جملة ركيكة لذا قد نحتاج لتغيير العبارة حسب 
السياق. سؤال طرحته أكثر من مرّة ولا مجيب! هل نحتاج أن أصلاً لحالة الصفر. مثلا 
هل يمكن أن يأتي مستخدما فيقوم بمسح صفر ملف فتخرج له رسالة تخبره هل أنت متأكّد 
من أنك تريد حذف صفر ملفاً إلى سلة المحذوفات؟ :)


> [1]: قطة واحدة
> [2]: قطتان
> [3]: %n من القطط
> [4]: %n قطط
> [5]: %n قطة

you mean by "n%100 ? 3" to say "n%100==2 ? 3"?
I can't understand how you made a dfference between 101 and 105. Do you want 
to say
101 من القطط كذلك 102 من القطط لكنك تود أن تقول 103 قطط؟
I believe it's not correct like this. But you have given me a good idea.

To solve this problem without lots of complications I would suggest:

for n>=2 to say 
من كذا مثلاً
2 من القطط
3 من القطط
4 من القطط
101 من القطط
150 من القطط

What do you think?

-- 
Munzir Taha  PGP Key available
gpg --recv-keys --keyserver www.mandrakesecure.net F0671821

Telecommunications and Electronics Engineer
Linux Registered User #279362 at http://counter.li.org
Mandrake Club member
Maintainer of the Open Arabic Bugs Project at
http://wiki.arabeyes.org/OpenBugs
CIW Designer, ICDL, MOUS
New Horizons CLC
Riyadh, SA