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

Re: plural forms in website translations

On 2005-08-03T20:56:18+0300, aragorn@tiscali.nl wrote:
> I know gettext has some support for differentiating between, IIRC,
> 0, 1, 2 and more. But support for something as fine grained as
> this...

Plural support in Gettext does support any number of cases including
the one mentioned here.

In Gettext there is that Plural-Forms in the header of po file. It
says how many different forms there are and C like expression to
select right form.

For example Slovenian uses this (example from Gettext info pages):

Plural-Forms: nplurals=4; \
    plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;

This means that there are four different looking plural forms. First
one is selected when number is 1, 101, 201, etc., second is selected
when number is 2, 102, 202, etc., third one is selected when number is
3, 4, 103, 104, 203, 204, etc. and fourth one in all other cases.

So at least GNU Gettext supports this, I don't know about the website
build process, but it is possible (at least in theory) to support all
different plural forms.

Tommi Vainikainen

Reply to: