* Alvaro Herrera <alvhe...@commandprompt.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,
ai...@highrise.ca                                       command like a king,
http://www.highrise.ca/                                   work like a slave.

Attachment: signature.asc
Description: Digital signature

Reply via email to