From 8b92dce1a64d623e76019a4b83576458defd63e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Herrera?= <alvherre@kurilemu.de>
Date: Thu, 23 Apr 2026 11:10:54 +0200
Subject: [PATCH] change translation markers in GetPublicationsStr

---
 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

