On Thu, Apr 23, 2026 at 7:25 PM Álvaro Herrera <[email protected]> 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: 0001-change-translation-markers-in-GetPublicationStr-PS.diff
Description: Binary data

Reply via email to