public inbox for [email protected]help / color / mirror / Atom feed
Redundant/mis-use of _(x) gettext macro? 17+ messages / 5 participants [nested] [flat]
* Redundant/mis-use of _(x) gettext macro? @ 2026-04-01 03:48 Peter Smith <[email protected]> 0 siblings, 2 replies; 17+ messages in thread From: Peter Smith @ 2026-04-01 03:48 UTC (permalink / raw) To: PostgreSQL Hackers <[email protected]> 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. AFAIK the purpose of using gettext (e.g. the "_(x)" macro) is for marking the string for i18n translation. But there's nothing even to translate here. Only 2 examples were found like this. Granted, this is probably not very harmful, but IMO it's better to patch the mis-use to prevent it from propagating. PSA the patch for more details. ====== [1] https://www.postgresql.org/message-id/CAHut%2BPtVaOYVP1R0TOoNh5G9CUBurrP%3D6i7fJCdfWEZiqVCRvw%40mail... Kind Regards, Peter Smith. Fujitsu Australia Attachments: [application/octet-stream] v1-0001-misuse-of-gettext-macro.patch (1.4K, 2-v1-0001-misuse-of-gettext-macro.patch) download | inline diff: From bd2a5ba9e7d65b4fc6e964048437ad776246b067 Mon Sep 17 00:00:00 2001 From: Peter Smith <[email protected]> Date: Wed, 1 Apr 2026 14:40:18 +1100 Subject: [PATCH v1] misuse of gettext macro --- src/backend/commands/tablecmds.c | 2 +- src/backend/replication/logical/relation.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 4ee58feb10e..65229b7384e 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -20732,7 +20732,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd, first = false; - appendStringInfo(&pubnames, _("\"%s\""), pubname); + appendStringInfo(&pubnames, "\"%s\"", pubname); } ereport(ERROR, diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c index 0b1d80b5b0f..02e60ddf516 100644 --- a/src/backend/replication/logical/relation.c +++ b/src/backend/replication/logical/relation.c @@ -253,7 +253,7 @@ logicalrep_get_attrs_str(LogicalRepRelation *remoterel, Bitmapset *atts) /* translator: This is a separator in a list of entity names. */ appendStringInfoString(&attsbuf, _(", ")); - appendStringInfo(&attsbuf, _("\"%s\""), remoterel->attnames[i]); + appendStringInfo(&attsbuf, "\"%s\"", remoterel->attnames[i]); } return attsbuf.data; -- 2.47.3 ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-01 03:57 Chao Li <[email protected]> parent: Peter Smith <[email protected]> 1 sibling, 0 replies; 17+ messages in thread From: Chao Li @ 2026-04-01 03:57 UTC (permalink / raw) To: Peter Smith <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> > On Apr 1, 2026, at 11:48, Peter Smith <[email protected]> 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. > > AFAIK the purpose of using gettext (e.g. the "_(x)" macro) is for > marking the string for i18n translation. But there's nothing even to > translate here. Indeed. > > Only 2 examples were found like this. Granted, this is probably not > very harmful, but IMO it's better to patch the mis-use to prevent it > from propagating. +1 > > PSA the patch for more details. > > ====== > [1] https://www.postgresql.org/message-id/CAHut%2BPtVaOYVP1R0TOoNh5G9CUBurrP%3D6i7fJCdfWEZiqVCRvw%40mail... > > Kind Regards, > Peter Smith. > Fujitsu Australia > <v1-0001-misuse-of-gettext-macro.patch> LGTM. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-01 11:52 Álvaro Herrera <[email protected]> parent: Peter Smith <[email protected]> 1 sibling, 2 replies; 17+ messages in thread From: Álvaro Herrera @ 2026-04-01 11:52 UTC (permalink / raw) To: Peter Smith <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> 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 »" -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "In fact, the basic problem with Perl 5's subroutines is that they're not crufty enough, so the cruft leaks out into user-defined code instead, by the Conservation of Cruft Principle." (Larry Wall, Apocalypse 6) ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-02 02:55 Peter Smith <[email protected]> parent: Álvaro Herrera <[email protected]> 1 sibling, 1 reply; 17+ messages in thread From: Peter Smith @ 2026-04-02 02:55 UTC (permalink / raw) To: Álvaro Herrera <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> On Wed, Apr 1, 2026 at 10:52 PM Álvaro Herrera <[email protected]> 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 »" > OK. Thanks for your explanation. ====== Kind Regards, Peter Smith. Fujitsu Australia ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-02 03:11 Chao Li <[email protected]> parent: Peter Smith <[email protected]> 0 siblings, 1 reply; 17+ messages in thread From: Chao Li @ 2026-04-02 03:11 UTC (permalink / raw) To: Álvaro Herrera <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>; Peter Smith <[email protected]> > On Apr 2, 2026, at 10:55, Peter Smith <[email protected]> wrote: > > On Wed, Apr 1, 2026 at 10:52 PM Álvaro Herrera <[email protected]> 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 »" >> > > OK. Thanks for your explanation. > Yep, good to learn. Noted. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-02 03:18 Tom Lane <[email protected]> parent: Chao Li <[email protected]> 0 siblings, 0 replies; 17+ messages in thread From: Tom Lane @ 2026-04-02 03:18 UTC (permalink / raw) To: Chao Li <[email protected]>; +Cc: Álvaro Herrera <[email protected]>; PostgreSQL Hackers <[email protected]>; Peter Smith <[email protected]> Chao Li <[email protected]> writes: > On Apr 2, 2026, at 10:55, Peter Smith <[email protected]> wrote: >> On Wed, Apr 1, 2026 at 10:52 PM Álvaro Herrera <[email protected]> wrote: >>> 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: > Yep, good to learn. Noted. This and related message style matters are covered in our docs, in https://www.postgresql.org/docs/devel/error-style-guide.html regards, tom lane ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-07 05:05 Peter Smith <[email protected]> parent: Álvaro Herrera <[email protected]> 1 sibling, 1 reply; 17+ messages in thread From: Peter Smith @ 2026-04-07 05:05 UTC (permalink / raw) To: Álvaro Herrera <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> On Wed, Apr 1, 2026 at 10:52 PM Álvaro Herrera <[email protected]> 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 Kind Regards, Peter Smith. Fujitsu Australia Attachments: [application/octet-stream] v1-0001-GetPublicationsStr-i18n-support.patch (1.2K, 2-v1-0001-GetPublicationsStr-i18n-support.patch) download | inline diff: From cd09ae7e4c18bfcb1b6522ec1aa16cfa3b5f502e Mon Sep 17 00:00:00 2001 From: Peter Smith <[email protected]> Date: Tue, 7 Apr 2026 14:45:11 +1000 Subject: [PATCH v1] GetPublicationsStr i18n support --- src/backend/catalog/pg_subscription.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/backend/catalog/pg_subscription.c b/src/backend/catalog/pg_subscription.c index 5a733585490..8b31c487dba 100644 --- a/src/backend/catalog/pg_subscription.c +++ b/src/backend/catalog/pg_subscription.c @@ -54,19 +54,22 @@ GetPublicationsStr(List *publications, StringInfo dest, bool quote_literal) { char *pubname = strVal(lfirst(lc)); - if (first) - first = false; - else - appendStringInfoString(dest, ", "); - if (quote_literal) + { + if (!first) + appendStringInfoString(dest, ", "); + appendStringInfoString(dest, quote_literal_cstr(pubname)); + } else { - appendStringInfoChar(dest, '"'); - appendStringInfoString(dest, pubname); - appendStringInfoChar(dest, '"'); + if (!first) + appendStringInfoString(dest, _(", ")); + + appendStringInfo(dest, _("\"%s\""), pubname); } + + first = false; } } -- 2.47.3 ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-23 07:24 Peter Smith <[email protected]> parent: Peter Smith <[email protected]> 0 siblings, 1 reply; 17+ messages in thread From: Peter Smith @ 2026-04-23 07:24 UTC (permalink / raw) To: Álvaro Herrera <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> On Tue, Apr 7, 2026 at 3:05 PM Peter Smith <[email protected]> wrote: > > On Wed, Apr 1, 2026 at 10:52 PM Álvaro Herrera <[email protected]> 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]. ====== [1] https://www.postgresql.org/message-id/CAApHDvoFSu5zLFvx96aZ5wvL7tcB9aR2hBPCaMPs8D_f0Z7eSw%40mail.gma... Kind Regards, Peter Smith. Fujitsu Australia Attachments: [application/octet-stream] v2-0001-GetPublicationsStr-i18n-support-for-quotes.patch (925B, 2-v2-0001-GetPublicationsStr-i18n-support-for-quotes.patch) download | inline diff: From f9a5034cd4d0f6eb930926de03e4e688c150eac3 Mon Sep 17 00:00:00 2001 From: Peter Smith <[email protected]> Date: Thu, 23 Apr 2026 17:18:03 +1000 Subject: [PATCH v2] GetPublicationsStr i18n support for quotes --- src/backend/catalog/pg_subscription.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/backend/catalog/pg_subscription.c b/src/backend/catalog/pg_subscription.c index 5a733585490..a91d7a4a0ef 100644 --- a/src/backend/catalog/pg_subscription.c +++ b/src/backend/catalog/pg_subscription.c @@ -62,11 +62,7 @@ GetPublicationsStr(List *publications, StringInfo dest, bool quote_literal) if (quote_literal) appendStringInfoString(dest, quote_literal_cstr(pubname)); else - { - appendStringInfoChar(dest, '"'); - appendStringInfoString(dest, pubname); - appendStringInfoChar(dest, '"'); - } + appendStringInfo(dest, _("\"%s\""), pubname); } } -- 2.47.3 ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-23 09:25 Álvaro Herrera <[email protected]> parent: Peter Smith <[email protected]> 0 siblings, 1 reply; 17+ messages in thread From: Álvaro Herrera @ 2026-04-23 09:25 UTC (permalink / raw) To: Peter Smith <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> 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. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-24 03:10 Peter Smith <[email protected]> parent: Álvaro Herrera <[email protected]> 0 siblings, 2 replies; 17+ messages in thread From: Peter Smith @ 2026-04-24 03:10 UTC (permalink / raw) To: Álvaro Herrera <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> 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 Attachments: [application/octet-stream] 0001-change-translation-markers-in-GetPublicationStr-PS.diff (1.5K, 2-0001-change-translation-markers-in-GetPublicationStr-PS.diff) download | inline diff: diff --git a/src/backend/catalog/pg_subscription.c b/src/backend/catalog/pg_subscription.c index 5a733585490..7749ec380de 100644 --- a/src/backend/catalog/pg_subscription.c +++ b/src/backend/catalog/pg_subscription.c @@ -41,31 +41,35 @@ static List *textarray_to_stringlist(ArrayType *textarray); /* * Add a comma-separated list of publication names to the 'dest' string. + * + * If quote_literal is true, the returned list can be used to construct an SQL + * command, thus no translation is applied. Otherwise, the string can be used + * to create a user-facing message, so translatable quote marks are added. */ void GetPublicationsStr(List *publications, StringInfo dest, bool quote_literal) { - ListCell *lc; - bool first = true; + int length = list_length(publications); Assert(publications != NIL); - foreach(lc, publications) + for (int i = 0; i < length; i++) { - char *pubname = strVal(lfirst(lc)); - - if (first) - first = false; - else - appendStringInfoString(dest, ", "); + char *pubname = strVal(list_nth(publications, i)); + bool last = i >= length - 1; if (quote_literal) + { appendStringInfoString(dest, quote_literal_cstr(pubname)); + if (!last) + appendStringInfoString(dest, ", "); + } else { - appendStringInfoChar(dest, '"'); - appendStringInfoString(dest, pubname); - appendStringInfoChar(dest, '"'); + if (last) + appendStringInfo(dest, _("\"%s\""), pubname); + else + appendStringInfo(dest, _("\"%s\", "), pubname); } } } ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-24 12:14 Álvaro Herrera <[email protected]> parent: Peter Smith <[email protected]> 1 sibling, 2 replies; 17+ messages in thread From: Álvaro Herrera @ 2026-04-24 12:14 UTC (permalink / raw) To: Peter Smith <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> 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. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Hay dos momentos en la vida de un hombre en los que no debería especular: cuando puede permitírselo y cuando no puede" (Mark Twain) ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-04-24 12:43 David Rowley <[email protected]> parent: Álvaro Herrera <[email protected]> 1 sibling, 0 replies; 17+ messages in thread From: David Rowley @ 2026-04-24 12:43 UTC (permalink / raw) To: Álvaro Herrera <[email protected]>; +Cc: Peter Smith <[email protected]>; PostgreSQL Hackers <[email protected]> On Sat, 25 Apr 2026 at 00:14, Álvaro Herrera <[email protected]> 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. Wouldn't it be simpler to put the comma on the other end of the name and use that if (foreach_current_index(lc) > 0) ? Or was this to reuse a translation and you didn't want to swap "\"%s\", " for , "\"%s\" ? David ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-05-18 05:26 Peter Smith <[email protected]> parent: Álvaro Herrera <[email protected]> 1 sibling, 0 replies; 17+ messages in thread From: Peter Smith @ 2026-05-18 05:26 UTC (permalink / raw) To: Álvaro Herrera <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> On Tue, Apr 28, 2026 at 11:57 AM Peter Smith <[email protected]> wrote: > > On Fri, Apr 24, 2026 at 10:14 PM Álvaro Herrera <[email protected]> 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. > This thread has been inactive for about 5 weeks. AFAIK, everybody was happy with the patch, and we were only debating if the translated format string should have a leading comma or a trailing comma. Either way is OK with me -- whatever way you think makes the most sense to a translator. What can I do to help the patch proceed to get pushed? ====== Kind Regards, Peter Smith. Fujitsu Australia ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-06-11 16:44 Álvaro Herrera <[email protected]> parent: Peter Smith <[email protected]> 1 sibling, 2 replies; 17+ messages in thread From: Álvaro Herrera @ 2026-06-11 16:44 UTC (permalink / raw) To: Peter Smith <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> On 2026-Apr-24, Peter Smith wrote: > OK. Including the comma within a larger translated string seems like a > better idea. [...] > Also, why did you choose to implement `last` versus `first` logic? > e.g. How about this? In the end I decided to go with the flow and changed to use "first" logic rather than "last". I also figured that we should change the other two places you pointed out at the start of the thread to use the same coding style. Since this is mostly cosmetic, I don't feel compelled to back-patch it, and pushed only to master. Another place I noticed while looking this over is psql's describeOneTableDetails(), per the attached patch. It's essentially more of the same, but arguably different enough that I judged it warranted posting before pushing. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-06-11 20:21 Álvaro Herrera <[email protected]> parent: Álvaro Herrera <[email protected]> 1 sibling, 0 replies; 17+ messages in thread From: Álvaro Herrera @ 2026-06-11 20:21 UTC (permalink / raw) To: Peter Smith <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>; Peter Eisentraut <[email protected]> On 2026-Jun-11, Álvaro Herrera wrote: > In the end I decided to go with the flow and changed to use "first" > logic rather than "last". I also figured that we should change the > other two places you pointed out at the start of the thread to use the > same coding style. Since this is mostly cosmetic, I don't feel > compelled to back-patch it, and pushed only to master. > > Another place I noticed while looking this over is psql's > describeOneTableDetails(), per the attached patch. It's essentially > more of the same, but arguably different enough that I judged it > warranted posting before pushing. Crap, I just noticed that Peter Eisentraut had made himself committer of this CF entry. Apologies, I've had this marked as pending on my inbox for so long that it didn't occur to me to check the CF page. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-06-11 22:57 Peter Smith <[email protected]> parent: Álvaro Herrera <[email protected]> 1 sibling, 1 reply; 17+ messages in thread From: Peter Smith @ 2026-06-11 22:57 UTC (permalink / raw) To: Álvaro Herrera <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> On Fri, Jun 12, 2026 at 2:44 AM Álvaro Herrera <[email protected]> wrote: > > On 2026-Apr-24, Peter Smith wrote: > > > OK. Including the comma within a larger translated string seems like a > > better idea. > [...] > > Also, why did you choose to implement `last` versus `first` logic? > > e.g. How about this? > > In the end I decided to go with the flow and changed to use "first" > logic rather than "last". I also figured that we should change the > other two places you pointed out at the start of the thread to use the > same coding style. Since this is mostly cosmetic, I don't feel > compelled to back-patch it, and pushed only to master. > Thanks for pushing! > Another place I noticed while looking this over is psql's > describeOneTableDetails(), per the attached patch. It's essentially > more of the same, but arguably different enough that I judged it > warranted posting before pushing. > This additional patch LGTM. ====== Kind Regards, Peter Smith. Fujitsu Australia ^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: Redundant/mis-use of _(x) gettext macro? @ 2026-06-12 12:26 Álvaro Herrera <[email protected]> parent: Peter Smith <[email protected]> 0 siblings, 0 replies; 17+ messages in thread From: Álvaro Herrera @ 2026-06-12 12:26 UTC (permalink / raw) To: Peter Smith <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> On 2026-Jun-12, Peter Smith wrote: > On Fri, Jun 12, 2026 at 2:44 AM Álvaro Herrera <[email protected]> wrote: > > Another place I noticed while looking this over is psql's > > describeOneTableDetails(), per the attached patch. It's essentially > > more of the same, but arguably different enough that I judged it > > warranted posting before pushing. > > This additional patch LGTM. Great, thanks for looking, pushed. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "XML!" Exclaimed C++. "What are you doing here? You're not a programming language." "Tell that to the people who use me," said XML. https://burningbird.net/the-parable-of-the-languages/ ^ permalink raw reply [nested|flat] 17+ messages in thread
end of thread, other threads:[~2026-06-12 12:26 UTC | newest] Thread overview: 17+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-04-01 03:48 Redundant/mis-use of _(x) gettext macro? Peter Smith <[email protected]> 2026-04-01 03:57 ` Chao Li <[email protected]> 2026-04-01 11:52 ` Álvaro Herrera <[email protected]> 2026-04-02 02:55 ` Peter Smith <[email protected]> 2026-04-02 03:11 ` Chao Li <[email protected]> 2026-04-02 03:18 ` Tom Lane <[email protected]> 2026-04-07 05:05 ` Peter Smith <[email protected]> 2026-04-23 07:24 ` Peter Smith <[email protected]> 2026-04-23 09:25 ` Álvaro Herrera <[email protected]> 2026-04-24 03:10 ` Peter Smith <[email protected]> 2026-04-24 12:14 ` Álvaro Herrera <[email protected]> 2026-04-24 12:43 ` David Rowley <[email protected]> 2026-05-18 05:26 ` Peter Smith <[email protected]> 2026-06-11 16:44 ` Álvaro Herrera <[email protected]> 2026-06-11 20:21 ` Álvaro Herrera <[email protected]> 2026-06-11 22:57 ` Peter Smith <[email protected]> 2026-06-12 12:26 ` Álvaro Herrera <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox