Thread: Re: Better title output for psql \dt \di etc. commands

Re: Better title output for psql \dt \di etc. commands

From
Álvaro Herrera
Date:
On 2025-Feb-03, Tom Lane wrote:

> One problem with it is that while we can leave "List of ???" out
> of the set of translatable strings easily, we can't currently
> do that for the argument of pg_log_error because it's automatically
> a gettext trigger.  I'd rather not burden translators with figuring
> out what to do with that.  Is it worth creating pg_log_error_internal,
> equivalently to elog and errmsg_internal in the backend?

At this point I would just add a "translator:" comment that explains
that the ??? bit is for unexpected cases and can be translated in the
same way.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"The problem with the future is that it keeps turning into the present"
(Hobbes)



Re: Better title output for psql \dt \di etc. commands

From
Tom Lane
Date:
=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@alvh.no-ip.org> writes:
> At this point I would just add a "translator:" comment that explains
> that the ??? bit is for unexpected cases and can be translated in the
> same way.

Hmm, do we have a standard policy or comment wording about that?
I looked for "translator: ... unexpected" and didn't find any
existing comments of that sort.

            regards, tom lane



Re: Better title output for psql \dt \di etc. commands

From
Álvaro Herrera
Date:
On 2025-Feb-04, Tom Lane wrote:

> =?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@alvh.no-ip.org> writes:
> > At this point I would just add a "translator:" comment that explains
> > that the ??? bit is for unexpected cases and can be translated in the
> > same way.
> 
> Hmm, do we have a standard policy or comment wording about that?
> I looked for "translator: ... unexpected" and didn't find any
> existing comments of that sort.

I don't remember cases of messages of that kind marked for translation,
so I'm not surprised that we don't have any such comments.  Those would
typically be elog() or the errfoo_internal() cases, I think.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"El sudor es la mejor cura para un pensamiento enfermo" (Bardia)



Re: Better title output for psql \dt \di etc. commands

From
Tom Lane
Date:
=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@alvh.no-ip.org> writes:
> On 2025-Feb-04, Tom Lane wrote:
>> =?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@alvh.no-ip.org> writes:
>>> At this point I would just add a "translator:" comment that explains
>>> that the ??? bit is for unexpected cases and can be translated in the
>>> same way.

>> Hmm, do we have a standard policy or comment wording about that?
>> I looked for "translator: ... unexpected" and didn't find any
>> existing comments of that sort.

> I don't remember cases of messages of that kind marked for translation,
> so I'm not surprised that we don't have any such comments.  Those would
> typically be elog() or the errfoo_internal() cases, I think.

Yeah, that's what I would have thought.

The implementation I had in mind was to just invent a
pg_log_error_internal() macro alias for pg_log_error().
That'd take about two lines counting the explanatory comment.
This approach would fail to suppress the cost of gettext's
trying to look up the string, but surely we aren't concerned
about that here --- we just want to not burden translators
with the string.  (I need to check that gettext isn't smart
enough to see through a macro, though.  If it is, a static
inline function should do.)

            regards, tom lane



Re: Better title output for psql \dt \di etc. commands

From
Álvaro Herrera
Date:
On 2025-Feb-04, Tom Lane wrote:

> The implementation I had in mind was to just invent a
> pg_log_error_internal() macro alias for pg_log_error().
> That'd take about two lines counting the explanatory comment.
> This approach would fail to suppress the cost of gettext's
> trying to look up the string, but surely we aren't concerned
> about that here --- we just want to not burden translators
> with the string.

Yeah, okay, that seems good enough for me.  I agree that the cost of an
unnecessary gettext() call is negligible.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/



Re: Better title output for psql \dt \di etc. commands

From
Tom Lane
Date:
=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@alvh.no-ip.org> writes:
> On 2025-Feb-04, Tom Lane wrote:
>> The implementation I had in mind was to just invent a
>> pg_log_error_internal() macro alias for pg_log_error().
>> That'd take about two lines counting the explanatory comment.
>> This approach would fail to suppress the cost of gettext's
>> trying to look up the string, but surely we aren't concerned
>> about that here --- we just want to not burden translators
>> with the string.

> Yeah, okay, that seems good enough for me.  I agree that the cost of an
> unnecessary gettext() call is negligible.

Sounds good, I'll proceed along those lines.

            regards, tom lane