From: | Aidan Van Dyk <aidan(at)highrise(dot)ca> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pg1(at)thetdh(dot)com, Sergey Burladyan <eshkinkot(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Improving the ngettext() patch |
Date: | 2009-06-04 14:45:38 |
Message-ID: | 20090604144537.GS23972@yugib.highrise.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
* Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> [090604 10:22]:
> pg(at)thetdh(dot)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(at)highrise(dot)ca command like a king,
http://www.highrise.ca/ work like a slave.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-06-04 14:52:27 | Re: Improving the ngettext() patch |
Previous Message | Gevik Babakhani | 2009-06-04 14:44:59 | Re: Question about FUNCDETAIL_MULTIPLE |