agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
[PATCH] Fix translation of pg_controldata's NextOID output
1+ messages / 1 participants
[nested] [flat]

* [PATCH] Fix translation of pg_controldata's NextOID output
@ 2026-09-14 03:34  Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  0 siblings, 0 replies; 1+ messages in thread

From: Kyotaro Horiguchi @ 2026-09-14 03:34 UTC (permalink / raw)

xgettext does not recognize OID8_FORMAT and therefore extracts an
incomplete message. Use PRIu64 instead, and document that the *_FORMAT
macros should not be used in translatable strings.
---
 src/bin/pg_controldata/pg_controldata.c | 4 ++--
 src/include/c.h                         | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index b785f7f4070..7011adeeb87 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -269,8 +269,8 @@ main(int argc, char *argv[])
 	printf(_("Latest checkpoint's NextXID:          %u:%u\n"),
 		   EpochFromFullTransactionId(ControlFile->checkPointCopy.nextXid),
 		   XidFromFullTransactionId(ControlFile->checkPointCopy.nextXid));
-	printf(_("Latest checkpoint's NextOID:          " OID8_FORMAT "\n"),
-		   ControlFile->checkPointCopy.nextOid);
+	/* Use PRIu64 because xgettext does not recognize OID8_FORMAT. */
+	printf(_("Latest checkpoint's NextOID:          %" PRIu64 "\n"),
 	printf(_("Latest checkpoint's NextMultiXactId:  %u\n"),
 		   ControlFile->checkPointCopy.nextMulti);
 	printf(_("Latest checkpoint's NextMultiOffset:  %" PRIu64 "\n"),
diff --git a/src/include/c.h b/src/include/c.h
index 20cfbac54e7..219346e8fae 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -689,7 +689,12 @@ typedef uint64_t uint64;
 #define INT64CONST(x)  INT64_C(x)
 #define UINT64CONST(x) UINT64_C(x)
 
-/* snprintf format strings to use for 64-bit integers */
+/*
+ * snprintf format strings to use for 64-bit integers
+ *		xgettext does not recognize these macros, resulting in incomplete
+ *		msgids in PO files. Use the corresponding PRI* macros directly in
+ *		translatable strings instead.
+ */
 #define INT64_FORMAT "%" PRId64
 #define UINT64_FORMAT "%" PRIu64
 #define OID8_FORMAT "%" PRIu64
-- 
2.52.0


----Next_Part(Mon_Sep_14_12_46_45_2026_013)----





^ permalink  raw  reply  [nested|flat] 1+ messages in thread


only message in thread

Thread overview: 1+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 03:34 [PATCH] Fix translation of pg_controldata's NextOID output Kyotaro Horiguchi <horikyota.ntt@gmail.com>

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