Hello,
Commit cb298616463 changed the following line:
- printf(_("Latest checkpoint's NextOID: %u\n"),
+ printf(_("Latest checkpoint's NextOID: " OID8_FORMAT "\n"),
It appears that xgettext does not recognize PostgreSQL's OID8_FORMAT
macro and therefore extracts only the preceding string literal as the
msgid. In contrast, PRIu64, which is used in the same file, is
correctly extracted as %<PRIu64>. Therefore, shouldn't we use "%"
PRIu64 instead of OID8_FORMAT here as well?
I confirmed that, with the attached patch, the complete string is
correctly extracted as the msgid in the PO files. The patch also adds
a comment at the macro definitions noting that *_FORMAT macros cannot
be used directly in translatable messages.
Regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
>From b5a8cabe8c9704f7b39de19ca263fdf68c7df9c2 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <[email protected]>
Date: Mon, 14 Sep 2026 12:34:35 +0900
Subject: [PATCH] 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 | 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