A couple of gripes about the gettext plurals patch

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
Subject: A couple of gripes about the gettext plurals patch
Date: 2009-04-26 18:29:20
Message-ID: 21740.1240770560@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I see that the recently committed changes typically use ngettext
in this style:

ereport(msglevel,
/* translator: %d always has a value larger than 1 */
(errmsg(ngettext("drop cascades to %d other object",
"drop cascades to %d other objects",
numReportedClient + numNotReportedClient),
numReportedClient + numNotReportedClient),

This is bogus: errmsg expects that it should itself feed its first
argument through gettext(), not receive an argument that is already
translated. That's at the least a waste of cycles, and it's not
entirely impossible that double translation could end up with a just
plain wrong result.

A simple fix would be to use errmsg_internal() in these cases, but I
wonder if we should instead invent nerrmsg() or something like that.
Anyway, there are some other usages besides errmsg(ngettext()) that
are broken in the same way and will also require consideration.

I'm also wondering whether PGAC_CHECK_GETTEXT() should be made to
check for ngettext() instead of bind_textdomain_codeset(). Which
one was added later?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton Egorov 2009-04-26 18:41:15 Restore deleted rows
Previous Message Grzegorz Jaskiewicz 2009-04-26 16:25:59 Re: GCC 4.4 compiler warnings