Re: NLS: use gettext() to translate system error messages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: NLS: use gettext() to translate system error messages
Date: 2025-12-23 20:21:10
Message-ID: 794918.1766521270@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> [1] Or at least that's the intent ... but I don't see translation
> happening in HEAD on my Linux box:

Huh ... it works fine on another nearby RHEL machine:

regression=# copy zed from '/etc/shadow';
ERROR: no se pudo abrir archivo «/etc/shadow» para lectura: Permiso denegado
HINT: COPY FROM indica al proceso servidor de PostgreSQL leer un archivo. Puede desear usar una facilidad del lado del cliente como \copy de psql.

But poking a little harder, the same behavior applies in other
programs:

RHEL8 box:

$ LANG=es_ES.utf8 sed 's/x/y/' /etc/shadow
sed: no se puede leer /etc/shadow: Permission denied

RHEL9 box:

$ LANG=es_ES.utf8 sed 's/x/y/' /etc/shadow
sed: no se puede leer /etc/shadow: Permiso denegado

Surely RHEL8 does not pre-date glibc's ability to translate messages.
I suspect I have some system-wide setting for this, or maybe a
missing package on that machine? But anyway, I think this reinforces
my point that we should (and do) act similarly to other programs.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2025-12-23 21:59:21 Re: Periodic authorization expiration checks using GoAway message
Previous Message Jeff Davis 2025-12-23 20:09:08 Re: Remaining dependency on setlocale()