public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Rowley <[email protected]>
To: PostgreSQL Developers <[email protected]>
To: Amit Kapila <[email protected]>
To: Peter Eisentraut <[email protected]>
Subject: Get rid of translation strings that only contain punctuation
Date: Wed, 22 Apr 2026 12:29:40 +1200
Message-ID: <CAApHDvoFSu5zLFvx96aZ5wvL7tcB9aR2hBPCaMPs8D_f0Z7eSw@mail.gmail.com> (raw)

(Follow-on work from [1])

We've got a few parts of the code that translate strings that contain
only a single punctuation character. I'm not a translator, but I
suspect that these would be tricky to deal with as such short strings
could be used for various different things, and if the required
translation was to differ between requirements, then you're out of
luck.

I looked at: git grep -A 1 "msgid \", \"" and I see French is the only
translation to do anything different with the ", " string, and only in
psql.

src/bin/psql/po/fr.po:msgid ", "
src/bin/psql/po/fr.po-msgstr " , "

This is used for suffixing "unique" or "unique nulls not distinct". I
adjusted the logic there to get rid of the short translation string.

Quite a few are new to v19: fd366065e (AmitK), 48efefa6c (AmitK),
0fc33b005 (PeterE)
The relation.c one is from v18: 8fcd80258 (AmitK)
The describe.c one is from v15: 94aa7cc5f (PeterE)

Should we get rid of these?

David

[1] https://postgr.es/m/CAApHDvohYOdrvhVxXzCJNX_GYMSWBfjTTtB6hgDauEtZ8Nar2A@mail.gmail.com


Attachments:

  [application/octet-stream] get_rid_of_single_punctuation_char_translation_strings.patch (4.7K, 2-get_rid_of_single_punctuation_char_translation_strings.patch)
  download | inline diff:
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index eec09ba1ded..e5ef0fdae7d 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -20588,8 +20588,8 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd,
 	exceptpuboids = GetRelationExcludedPublications(RelationGetRelid(attachrel));
 	if (exceptpuboids != NIL)
 	{
-		bool		first = true;
 		StringInfoData pubnames;
+		char		  *sep = "";
 
 		initStringInfo(&pubnames);
 
@@ -20597,18 +20597,9 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd,
 		{
 			char	   *pubname = get_publication_name(pubid, false);
 
-			if (!first)
-			{
-				/*
-				 * translator: This is a separator in a list of publication
-				 * names.
-				 */
-				appendStringInfoString(&pubnames, _(", "));
-			}
-
-			first = false;
-
-			appendStringInfo(&pubnames, _("\"%s\""), pubname);
+			appendStringInfoString(&pubnames, sep);
+			appendStringInfo(&pubnames, "\"%s\"", pubname);
+			sep = ", ";
 		}
 
 		ereport(ERROR,
diff --git a/src/backend/replication/logical/conflict.c b/src/backend/replication/logical/conflict.c
index 2887dfb7150..8adbb60af6d 100644
--- a/src/backend/replication/logical/conflict.c
+++ b/src/backend/replication/logical/conflict.c
@@ -195,7 +195,7 @@ static void
 append_tuple_value_detail(StringInfo buf, List *tuple_values,
 						  bool need_newline)
 {
-	bool		first = true;
+	char	   *prefix = ": ";
 
 	Assert(buf != NULL && tuple_values != NIL);
 
@@ -209,31 +209,12 @@ append_tuple_value_detail(StringInfo buf, List *tuple_values,
 		if (!tuple_value)
 			continue;
 
-		if (first)
-		{
-			/*
-			 * translator: The colon is used as a separator in conflict
-			 * messages. The first part, built in the caller, describes what
-			 * happened locally; the second part lists the conflicting keys
-			 * and tuple data.
-			 */
-			appendStringInfoString(buf, _(": "));
-		}
-		else
-		{
-			/*
-			 * translator: This is a separator in a list of conflicting keys
-			 * and tuple data.
-			 */
-			appendStringInfoString(buf, _(", "));
-		}
-
+		appendStringInfoString(buf, prefix);
 		appendStringInfoString(buf, tuple_value);
-		first = false;
+		prefix = ", ";
 	}
 
-	/* translator: This is the terminator of a conflict message */
-	appendStringInfoString(buf, _("."));
+	appendStringInfoChar(buf, '.');
 
 	if (need_newline)
 		appendStringInfoChar(buf, '\n');
diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c
index 0b1d80b5b0f..edf2b671ebc 100644
--- a/src/backend/replication/logical/relation.c
+++ b/src/backend/replication/logical/relation.c
@@ -239,7 +239,7 @@ static char *
 logicalrep_get_attrs_str(LogicalRepRelation *remoterel, Bitmapset *atts)
 {
 	StringInfoData attsbuf;
-	int			attcnt = 0;
+	char	   *sep = "";
 	int			i = -1;
 
 	Assert(!bms_is_empty(atts));
@@ -248,12 +248,9 @@ logicalrep_get_attrs_str(LogicalRepRelation *remoterel, Bitmapset *atts)
 
 	while ((i = bms_next_member(atts, i)) >= 0)
 	{
-		attcnt++;
-		if (attcnt > 1)
-			/* translator: This is a separator in a list of entity names. */
-			appendStringInfoString(&attsbuf, _(", "));
-
-		appendStringInfo(&attsbuf, _("\"%s\""), remoterel->attnames[i]);
+		appendStringInfoString(&attsbuf, sep);
+		appendStringInfo(&attsbuf, ("\"%s\""), remoterel->attnames[i]);
+		sep = ", ";
 	}
 
 	return attsbuf.data;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index c4c3fbc4fe3..d6c26149991 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3168,18 +3168,8 @@ parse_and_validate_value(const struct config_generic *record,
 
 					hintmsg = config_enum_get_options(conf,
 													  _("Available values: "),
-
-					/*
-					 * translator: This is the terminator of a list of entity
-					 * names.
-					 */
-													  _("."),
-
-					/*
-					 * translator: This is a separator in a list of entity
-					 * names.
-					 */
-													  _(", "));
+													  ".",
+													  ", ");
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index dd1179ef927..850dffbf158 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2504,10 +2504,10 @@ describeOneTableDetails(const char *schemaname,
 				printfPQExpBuffer(&tmpbuf, _("primary key, "));
 			else if (strcmp(indisunique, "t") == 0)
 			{
-				printfPQExpBuffer(&tmpbuf, _("unique"));
 				if (strcmp(indnullsnotdistinct, "t") == 0)
-					appendPQExpBufferStr(&tmpbuf, _(" nulls not distinct"));
-				appendPQExpBufferStr(&tmpbuf, _(", "));
+					appendPQExpBufferStr(&tmpbuf, _("unique nulls not distinct, "));
+				else
+					printfPQExpBuffer(&tmpbuf, _("unique, "));
 			}
 			else
 				resetPQExpBuffer(&tmpbuf);


view thread (9+ 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], [email protected], [email protected], [email protected]
  Subject: Re: Get rid of translation strings that only contain punctuation
  In-Reply-To: <CAApHDvoFSu5zLFvx96aZ5wvL7tcB9aR2hBPCaMPs8D_f0Z7eSw@mail.gmail.com>

* 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