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-28 01:57:00
Message-ID: CAHut+PtsPumPOLLK0UZS_VA84qf-9sw8mzfpHOxbSLt7UKt3WA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 24, 2026 at 10:14 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
>
> On 2026-Apr-24, Peter Smith wrote:
>
> > 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`.
>
> WFM.
>
> > Also, why did you choose to implement `last` versus `first` logic?
> > e.g. How about this?
>
> > {
> > if (first)
> > appendStringInfo(dest, _("\"%s\""), pubname);
> > else
> > appendStringInfo(dest, _(", \"%s\""), pubname);
> > }
>
> I don't know, it just seemed more natural. The whole ", foo" style
> simply feels weird to me. It seems a matter of choice only though, so
> if you feel strongly about this, I'm not opposed.
>

Personally, I prefer `first` logic because
a) The length of the list is not required up-front
b) At each iteration, the built string makes sense instead of always
having a dangling ',' until the final iteration

But it is not a big deal. This thread is about the translation part,
so whatever way makes the most sense for translators is fine with me.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alena Rybakina 2026-04-28 02:16:29 Re: Vacuum statistics
Previous Message Bharath Rupireddy 2026-04-28 01:40:00 Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE