A couple of gripes about the gettext plurals patch - Mailing list pgsql-hackers

From Tom Lane
Subject A couple of gripes about the gettext plurals patch
Date
Msg-id 21740.1240770560@sss.pgh.pa.us
Whole thread Raw
Responses Re: A couple of gripes about the gettext plurals patch  (Peter Eisentraut <peter_e@gmx.net>)
List 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("dropcascades 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


pgsql-hackers by date:

Previous
From: "Valtonen, Hannu"
Date:
Subject: Re: Patch to add support for text/int arrays for plpythonu
Next
From: Andrej
Date:
Subject: Re: RFE: Transparent encryption on all fields