public inbox for [email protected]  
help / color / mirror / Atom feed
From: Álvaro Herrera <[email protected]>
Subject: [PATCH] change translation markers in GetPublicationsStr
Date: Thu, 23 Apr 2026 11:10:54 +0200

---
 src/backend/catalog/pg_subscription.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/backend/catalog/pg_subscription.c b/src/backend/catalog/pg_subscription.c
index 1f1fdc75af6..d1e2e9de468 100644
--- a/src/backend/catalog/pg_subscription.c
+++ b/src/backend/catalog/pg_subscription.c
@@ -41,31 +41,36 @@ 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)
 	{
 		char	   *pubname = strVal(lfirst(lc));
-
-		if (first)
-			first = false;
-		else
-			appendStringInfoString(dest, ", ");
+		bool		last = foreach_current_index(lc) >= 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);
 		}
 	}
 }
-- 
2.47.3


--4pbgraihc64wxsmv--





view thread (323+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH] change translation markers in GetPublicationsStr
  In-Reply-To: <no-message-id-1164555@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox