From: | Aidan Van Dyk <aidan(at)highrise(dot)ca> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Zdenek Kotala <Zdenek(dot)Kotala(at)sun(dot)com> |
Subject: | Re: problem with plural-forms |
Date: | 2009-05-26 14:36:03 |
Message-ID: | 20090526143603.GB15213@yugib.highrise.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
* Alvaro Herrera <alvherre(at)commandprompt(dot)com> [090526 10:06]:
> Tom Lane wrote:
>
> > That advice is, if not outright wrong, at least incredibly
> > short-sighted. The method breaks the instant you have any additional
> > values to print. For example, this ain't gonna work:
> >
> > printf (ngettext ("One file removed, containing %lu bytes",
> > "%d files removed, containing %lu bytes", n),
> > n, total_bytes);
>
> I think it should use the %2$s style specifier in that case. This
> should work:
>
> > printf (ngettext ("One file removed, containing %2$lu bytes",
> > "%d files removed, containing %lu bytes", n),
> > n, total_bytes);
From the glibc printf man page:
"There may be no gaps in the numbers of arguments specified using
'$'; for example, if arguments 1 and 3 are specified, argument 2 must
also be specified somewhere in the format string."
So, is skipping 1 allowed?
But, it *is* a commonly used form, especially in translations (where
orders of things need to be flipped), and is already used in many of the
translated PG .po files.
That said, I do think the "msgid" should be using the % args, not words
for a few reasons:
1) Make it more clear for translators the arguments and their ordering
without having to visit the source code
2) On crufty systems without gettext, I wouldn't expect them to support m$
modifiers then either...
3) Greg's "these are numbers, not sentences" is how I expect the system
to work...
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 | Magnus Hagander | 2009-05-26 14:36:56 | Re: generic options for explain |
Previous Message | Peter Eisentraut | 2009-05-26 14:34:32 | Re: problem with plural-forms |