[Mailman-i18n] another question

Mikhail Sobolev mikhail.sobolev@transas.com
Tue, 2 Oct 2001 09:23:14 +0100


On Mon, Oct 01, 2001 at 08:01:58PM -0400, Barry A. Warsaw wrote:
> 
> >>>>> "MS" == Mikhail Sobolev <mikhail.sobolev@transas.com> writes:
> 
>     MS> Are you going to do something similar for Russian, then? :)) I
>     MS> believe, here we have at least three possible cases... :))
> 
> Can you suggest what needs to be done?
Well, if I understand it right, as for the current [in Debian] version
of gettext (0.10.40), there is a special construct in .po files, which
allow different appropriate translation of plural forms.  My
understanding (as I never used it) is that you need to use ngettext
instead of gettext in cases, where the result speaks about amounts.  So
briefly (I almost quote the info page for gettext, the section `Plural
Forms')

Instead of

    printf (gettext ("We've got %d bird(s)"), n);

and even

    if (n == 1)
        printf (gettext ("We've got 1 bird"));
    else
        printf (gettext ("We've got %d birds"), n);

one would need to use

    printf (ngettext ("We've got %d bird", "We've got %d birds"), n);

Where the first string is used as the msgid, and the second string is
used for the English language in case n != 1.

You'd need to add a special line to the header entry (example for
Russian):

Plural-Forms: nplurals=3; \
    plural=n%10==1 && n%100!=11 ? 0 : \
                n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;

And every entry that corresponds to such a text:

msgid "the singular form"
msgid_plural "the plural form"
msgstr[0] "translated string for the case 0"
...
msgstr[n] "translated string for the case 0"

--
Misha