Re: [Mailman-i18n] another question

[email protected] (Barry A. Warsaw)
Newsgroups gmane.comp.python.internationalization
Message-ID <[email protected]>
[I'm cc'ing Python's i18n-sig... -baw]

>>>>> "MS" == Mikhail Sobolev <[email protected]> writes:

    MS> Are you going to do something similar for Russian, then? :)) I
    MS> believe, here we have at least three possible cases... :))

    BAW> Can you suggest what needs to be done?

    MS> Well, if I understand it right, as for the current [in Debian]
    MS> version of gettext (0.10.40), there is a special construct in
    MS> .po files, which allow different appropriate translation of
    MS> plural forms.  My understanding (as I never used it) is that
    MS> you need to use ngettext instead of gettext in cases, where
    MS> the result speaks about amounts.  So briefly (I almost quote
    MS> the info page for gettext, the section `Plural Forms')

    MS> Instead of

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

    MS> and even

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

    MS> one would need to use

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

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

    MS> You'd need to add a special line to the header entry (example
    MS> 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;

    MS> 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"

None of the Python i18n tools supports ngettext or Plural forms.  I
definitely don't have the time right now to enhance either the gettext
module or pygettext.py to grok this, which seems pretty complicated to
me <wink>.

Unless someone volunteers to add such support to the Python i18n
tools, I suggest we find a way to hack around it in the Mailman source
code.

Cheers,
-Barry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.