Re: problem with plural-forms

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: 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 13:47:44
Message-ID: 10794.1243345664@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> On Monday 25 May 2009 19:11:24 Zdenek Kotala wrote:
>> The problem here is (1 row) instead of (%lu row). When I run msgfmt
>> without -v everything works fine but I think we should fixed it (there
>> are more occurrences of this issue).

> GNU gettext accepts this, and in fact the GNU gettext documentation explicitly
> points out that this allowed:

> In the English singular case, the number - always 1 - can be
> replaced with "one":

> printf (ngettext ("One file removed", "%d files removed", n), n);

> This works because the `printf' function discards excess arguments
> that are not consumed by the format string.

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'm of the opinion that the test being performed by msgfmt -v is
entirely reasonable, and we should not risk such problems for the sake
of sometimes spelling out "one".

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-05-26 13:52:36 Re: generic options for explain
Previous Message Zdenek Kotala 2009-05-26 13:44:34 Re: [PATCH] cleanup hashindex for pg_migrator hashindex compat mode (for 8.4)