pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Subject: create_help.pl treats <literal> as replaceable
Date: Tue, 17 May 2022 17:43:42 +0900 (JST)
Message-ID: <20220517.174342.1884842412165214815.horikyota.ntt@gmail.com> (raw)

I found it annoying that sql_help.c contains a literal parameter as a
translatable string.

The cause is that create_help.pl treats <literal>match</> as a
replaceable. The attached excludes literals from translatable strings.

By a quick look it seems to me that the "match" in "COPY.. HEADER
match" is the first and only instance of a literal parameter as of
PG15.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Attachments:

  [text/x-patch] 0001-Do-not-treat-literal-words-as-translatable.patch (978B, ../20220517.174342.1884842412165214815.horikyota.ntt@gmail.com/2-0001-Do-not-treat-literal-words-as-translatable.patch)
  download | inline diff:
From 81770afd9df6f073c50f875b2dd540273ecc15fa Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Tue, 17 May 2022 17:37:33 +0900
Subject: [PATCH] Do not treat <literal> words as translatable

create_help.pl extracts <literal> words as translatable but actually
they are untranslatable.  Exclude such words from translatable words
so that translators don't mistakenly translate the words.
---
 src/bin/psql/create_help.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/bin/psql/create_help.pl b/src/bin/psql/create_help.pl
index 1a9836cbcc..9919aaf4e7 100644
--- a/src/bin/psql/create_help.pl
+++ b/src/bin/psql/create_help.pl
@@ -138,6 +138,11 @@ foreach my $file (sort readdir DIR)
 
 		while ($cmdsynopsis =~ m!<(\w+)[^>]*>(.+?)</\1[^>]*>!)
 		{
+			if ($1 eq "literal")
+			{
+				$cmdsynopsis =~ s!<(\w+)[^>]*>(.+?)</\1[^>]*>!\2!;
+				next;
+			}
 			my $match = $2;
 			$match =~ s/<[^>]+>//g;
 			$match =~ s/%%/%/g;
-- 
2.27.0

view thread (9+ messages)  latest in thread

Message-ID: <20220517.174342.1884842412165214815.horikyota.ntt@gmail.com>
Permalink:  ../20220517.174342.1884842412165214815.horikyota.ntt@gmail.com/
Also on:    postgresql.org/message-id/20220517.174342.1884842412165214815.horikyota.ntt@gmail.com

 ·  · 

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: pgsql-hackers@postgresql.org
  Cc: horikyota.ntt@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: create_help.pl treats <literal> as replaceable
  In-Reply-To: <20220517.174342.1884842412165214815.horikyota.ntt@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox