Re: po files header, Plural-Forms



On mið, 2008-05-07 at 00:04 +0200, Kenneth Nielsen wrote:
> I'm pretty sure that "plural=n != 1" means that it should use the
> plural string for any numbers different from 1, and I think it should
> be that in GNOME as well. It makes a little more sence if you put a
> parantheses around it "plural=(n!=1). The != is a programming way of
> wiriting "not equals".
> Regards Kenneth 

Hi Kenneth, 
that makes sense. It took a bit of reading to understand that 
'plural' is really a C function. I thougnt it was just a constant 
like anything else in that file. 

At the same time we have translations like this (en_GB): 
msgid "%d × %d pixel"
msgid_plural "%d × %d pixels"
msgstr[0] "%d × %d pixel"
msgstr[1] "%d × %d pixels"

And the function f = plural(n) = (n!=1) has the two values: 
n=0        => f(n) = 1     # 0 pixels
n=1        => f(n) = 0     # 1 pixel
n=2...inf  => f(n) = 1     # 2 pixels  

Ahh, so the f(n) is the index to msgstr. Ok, now i understand it. 
I suppose there are some other translators that do not understand this. 
I think the key to understanding this, is to realize that plural 
is really a C function of n which is the numerical argument that
controls the textual context. 
Also I had to know that the function plural is really the index 
to the msgstr[0], msgstr[1] array. 
Hope this helps understanding the plural function. 
Thanks for your explanations. 

-- 
Kindest Regards, Anna Jonna Ármannsdóttir,       %&   A: Because people read from top to bottom.
Unix System Aministration, Computing Services,   %&   Q: Why is top posting bad?
University of Iceland.



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