bug-gnubg
[Top][All Lists]
Advanced

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

[Bug-gnubg] ngettext() support for plurals


From: TAKAHASHI Kaoru
Subject: [Bug-gnubg] ngettext() support for plurals
Date: Sat, 10 Jul 2004 18:49:29 +0900
User-agent: Wanderlust/2.11.30 (Wonderwall) SUTEMI/1.14.6 (White Eve) FLIM/1.14.6 (Marutamachi) MULE XEmacs/21.4 (patch 15) (Security Through Obscurity) (i686-pc-linux)

Hi,

I have committed ngettext() plural support to i18n.h.
But, I have not yet to Add "Plural-Forms:" to cs.po and ru.po.


I'll using ngettext() instead of "? :" expression.  ngettext()
helps languages where the plural form of a noun is not simply
constructed by adding an `s' but that is all.

/* old */
((ms.nMatchTo == 1) ? "Match to %d point" : "Match to %d points")

/* ngettext style */
ngettext("Match to %d point", "Match to %d points", ms.nMatchTo)


Can I commit using ngettext() C code?

Regards,


----------------------------------------------------------------
For po maintainers example:

Some langulage only require one single form. (e.g. Japanese )
"Plural-Forms: nplurals=1; plural=0;\n"

nplurals means number of plural pattern.
plural=0 means always use msgstr[0].

# ja
msgid "Match to %d point"
msgid_plural "Match to %d points"
msgstr[0] "%d POINTO MATTI" # any n


Two forms, (e.g. English)
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

This uses the feature of C expressions that boolean expressions
have to value zero or one. (1 == 1) is 0.  In other wards if
(n == 1) then plural=0, (n != 1) then plural=1.

# en_US
msgid "Match to %d point"
msgid_plural "Match to %d points"
msgstr[0] "Match to %d point"  # n == 1
msgstr[1] "Match to %d points" # n == 0, 2, 3 ...


Tree forms, (Czech, 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);"

# Czech, Russian 
msgid "Match to %d point"
msgid_plural "Match to %d points"
msgstr[0] "..." # n == 1, 21, 31 ...
msgstr[1] "..." # n == 2, 3, 4, 22, 23, 24 ...
msgstr[2] "..." # other
----------------------------------------------------------------

-- 
TAKAHASHI Kaoru




reply via email to

[Prev in Thread] Current Thread [Next in Thread]