Re: Redundant/mis-use of _(x) gettext macro?

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Redundant/mis-use of _(x) gettext macro?
Date: 2026-04-24 03:10:03
Message-ID: CAHut+Pu7LWQB+m9HTf4nf3BQu8bC_-N5c=kuOf=EHHZE_Ctj9Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 23, 2026 at 7:25 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
>
> On 2026-Apr-23, Peter Smith wrote:
>
> > v2 removes translation of the comma separator, due to the discussion
> > over at [1].
>
> Hmm, at least Japanese uses a different character for commas, and
> apparently French likes to add a space, so I think this is a bad move.
> I think we could handle these things by including the comma together
> with the literal in each element of the list being constructed, as in
> the attached.
>

OK. Including the comma within a larger translated string seems like a
better idea.

Since you now have the list `length`, I wondered why not simplify
further to use list_nth indexing? Then you can remove
`foreach_current_index` and `lc`.

PSA.

~~~~

Also, why did you choose to implement `last` versus `first` logic?
e.g. How about this?

------
GetPublicationsStr(List *publications, StringInfo dest, bool quote_literal)
{
ListCell *lc;
bool first = true;

Assert(publications != NIL);

foreach(lc, publications)
{
char *pubname = strVal(lfirst(lc));

if (quote_literal)
{
if (!first)
appendStringInfoString(dest, ", ");
appendStringInfoString(dest, quote_literal_cstr(pubname));
}
else
{
if (first)
appendStringInfo(dest, _("\"%s\""), pubname);
else
appendStringInfo(dest, _(", \"%s\""), pubname);
}

first = false;
}
}
------

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
0001-change-translation-markers-in-GetPublicationStr-PS.diff application/octet-stream 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-04-24 03:15:50 Re: pg_test_timing: fix unit typo and widen diff type
Previous Message Masashi Kamura (Fujitsu) 2026-04-24 03:08:36 RE: ECPG: inconsistent behavior with the document in “GET/SET DESCRIPTOR.”