From ed2132b4a963dfd04098af8b753f1a7b8218606f Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Mon, 14 Sep 2026 12:34:35 +0900
Subject: [PATCH v2] Fix translation of pg_controldata's NextOID output

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 | 3 ++-
 src/include/c.h                         | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index b785f7f4070..616df997d42 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -269,7 +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"),
+	/* Use PRIu64 because xgettext does not recognize OID8_FORMAT. */
+	printf(_("Latest checkpoint's NextOID:          %" PRIu64 "\n"),
 		   ControlFile->checkPointCopy.nextOid);
 	printf(_("Latest checkpoint's NextMultiXactId:  %u\n"),
 		   ControlFile->checkPointCopy.nextMulti);
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

