| 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-23 07:24:49 |
| Message-ID: | CAHut+PuD2pGMEKmk2dFA+guzxBEOas5+=LAm5E+SM2LU35KOnQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Apr 7, 2026 at 3:05 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> On Wed, Apr 1, 2026 at 10:52 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
> >
> > On 2026-Apr-01, Peter Smith wrote:
> >
> > > Hi.
> > >
> > > As originally reported [1] in the EXCEPT (TABLE ...) thread, I felt
> > > the _() gettext macro is mis-used when it contains nothing but a
> > > quoted format string.
> >
> > No, you feel wrong -- this is necessary so that the translator has
> > control over the quoting style of a list of items. Not all translations
> > use double quoting. Some examples from different language files:
> >
> > msgstr "unbekannte Komprimierungsoption: »%s«"
> > msgstr "opción de compresión no reconocida: «%s»"
> > msgstr "option de compression inconnue : « %s »"
> > msgstr "tidak dapat menentukan encoding untuk lokal « %s » : codesetnya adalah « %s »"
> >
>
> The explanation [1] that even the comma separators and the quotes are
> translatable parts of the message reminded me to revisit the
> `GetPublicationsStr` function.
>
> This function builds a comma-separated list of publication names.
>
> It is called in 2 scenarios:
> 1. to construct a pubname list to be included in some SQL (here,
> parameter quote_literal=true)
> 2. to construct a pubname list to be included in some error message
> (here, parameter quote_literal=false).
>
> In hindsight, it looks like this function has been broken since it was
> originally implemented 4 yrs ago (8f2e2bb), because it does not allow
> translation of commas and quotes when the result is being used for
> error messages.
>
> PSA a patch to fix that.
>
> ======
> [1] https://www.postgresql.org/message-id/202604011144.jeo56tazdx6z%40alvherre.pgsql
>
PSA patch v2.
v2 removes translation of the comma separator, due to the discussion
over at [1].
Kind Regards,
Peter Smith.
Fujitsu Australia
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-GetPublicationsStr-i18n-support-for-quotes.patch | application/octet-stream | 925 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ashutosh Bapat | 2026-04-23 07:27:37 | Re: Fix DROP PROPERTY GRAPH "unsupported object class" error |
| Previous Message | Michael Paquier | 2026-04-23 07:22:15 | Re: CheckAttributeType() forgot to recurse into multiranges |