Re: Improving the ngettext() patch
От | Aidan Van Dyk |
---|---|
Тема | Re: Improving the ngettext() patch |
Дата | |
Msg-id | 20090604144537.GS23972@yugib.highrise.ca обсуждение исходный текст |
Ответ на | Re: Improving the ngettext() patch (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Improving the ngettext() patch
|
Список | pgsql-hackers |
* Tom Lane <tgl@sss.pgh.pa.us> [090604 10:22]: > pg@thetdh.com writes: > >> Russian plural forms for 100, 101, 102 etc. is different, as for 0, 1, 2. > > > True. The rule IIRC is that except for 11-14 and for collective numerals, declination follows the last digit. > > Wow. So how does anyone represent that in the .po files? AFAICT the > notation the gettext machinery provides isn't really powerful enough > for this. Well, the C/english "template" one includes just the msgid, and msgid_plural string. When the russian translators get to it, they make a russion .po which contains (something like) the following in the msgid "" header:"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;\n" And then they provide msgstr[0], msgstr[1], and msgstr[2] to fill the 3 slots that above plural-forms can use when translationg plural-form strings. It's all encapsulated in the gettext tools and libraries, and the C (non-translated) base just always uses ngetttext(single, plural, n), and ngettext will (if the compiled catalog has different plural-forms) use whatever the catalog specifies, or fall back to the simple n == 1 ? singular : plural type choice when no translated catalog is available. a. -- Aidan Van Dyk Create like a god, aidan@highrise.ca command like a king, http://www.highrise.ca/ work like a slave.
В списке pgsql-hackers по дате отправления: