Re: In coreutil 9.11, translations are not displayed in locales other than English

Paul Eggert <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.gnu.coreutils.general
Organization UCLA Computer Science Department
Message-ID <[email protected]>
On 2026-08-25 06:51, Pádraig Brady wrote:

> The gnulib-tool docs state this can be done by us adding
> the following to configure.ac:
>    AC_DEFINE([GNULIB_TEXT_DOMAIN], [PACKAGE])
Yes, somehow we missed that memo for coreutils. Thanks, ribbon, for reporting the bug.

I installed the attached coreutils patch to fix things on the coreutils side. While doing so I noticed a couple of glitches on the Gnulib side and installed the attached two Gnulib patches.
0001-maint-translate-messages-from-Gnulib.patch (text/x-patch, 1.8 KB)
From 9068289c956063d26fe7ee2b54d620d1fc2eb27e Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 25 Aug 2026 10:24:20 -0700
Subject: [PATCH] maint: translate messages from Gnulib

Problem reported by ribbon in:
https://lists.gnu.org/r/coreutils/2026-08/msg00093.html
* configure.ac (GNULIB_TEXT_DOMAIN): Define.
* po/POTFILES.in: Add lib/parse-datetime.y.
---
 NEWS           | 3 +++
 configure.ac   | 4 ++++
 po/POTFILES.in | 1 +
 3 files changed, 8 insertions(+)

diff --git a/NEWS b/NEWS
index cf9334ef0..5250945cd 100644
--- a/NEWS
+++ b/NEWS
@@ -80,6 +80,9 @@ GNU coreutils NEWS                                    -*- outline -*-
   locales like SHIFT-JIS where a single byte can decode to a wide character.
   [bug introduced in coreutils-9.5]
 
+  Messages from Gnulib are no longer mistranslated in non-English locales.
+  [bug introduced in coreutils-9.6]
+
 ** New Features
 
   'env' now supports --env0-from=FILE to read NUL-delimited environment entries
diff --git a/configure.ac b/configure.ac
index 3b44c5778..025c3edc6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,10 @@ gl_SET_CRYPTO_CHECK_DEFAULT([auto-gpl-compat])
 gl_INIT
 coreutils_MACROS
 
+# Translate Gnulib msgids ourselves, instead of using the gnulib-l10n module.
+AC_DEFINE([GNULIB_TEXT_DOMAIN], [PACKAGE],
+  [The text domainname for Gnulib messages.])
+
 # These are safe, since 'sort', coreutils's only multithreaded app,
 # does not use the relevant modules, or calls their code from one thread.
 AC_DEFINE([GNULIB_EXCLUDE_SINGLE_THREAD], [1],
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 905de6e26..326688ca6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,6 +14,7 @@ lib/getopt.c
 lib/mkdir-p.c
 lib/obstack.c
 lib/openat-die.c
+lib/parse-datetime.y
 lib/quotearg.c
 lib/randread.c
 lib/regcomp.c
-- 
2.53.0
0001-gettext-h-tests-don-t-assume-ENABLE_NLS.patch (text/x-patch, 1.2 KB)
From 983e052b06e8bfa2237b1f9704c742ae34f28d76 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 25 Aug 2026 10:00:43 -0700
Subject: [PATCH 1/2] =?UTF-8?q?gettext-h-tests:=20don=E2=80=99t=20assume?=
 =?UTF-8?q?=20ENABLE=5FNLS?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* tests/test-gettext-h.c (main) [!ENABLE_NLS]:
Do not call textdomain, as it is not in scope.
---
 ChangeLog              | 6 ++++++
 tests/test-gettext-h.c | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 802b45cab2..86f7f3804e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-08-25  Paul Eggert  <[email protected]>
+
+	gettext-h-tests: don’t assume ENABLE_NLS
+	* tests/test-gettext-h.c (main) [!ENABLE_NLS]:
+	Do not call textdomain, as it is not in scope.
+
 2026-08-24  Paul Eggert  <[email protected]>
 
 	gettext: more-consistent no-op macros
diff --git a/tests/test-gettext-h.c b/tests/test-gettext-h.c
index c6ad35cd65..fa0a795c31 100644
--- a/tests/test-gettext-h.c
+++ b/tests/test-gettext-h.c
@@ -27,7 +27,9 @@ main (void)
 {
   const char *s;
 
+#if ENABLE_NLS
   textdomain ("tzlof");
+#endif
 
   s = gettext ("some text");
   if (!streq (s, "some text"))
-- 
2.53.0
0002-getaddrinfo-getaddrinfo.c-doesn-t-need-gettext.h.patch (text/x-patch, 1.3 KB)
From 0052b2684981072464c4ec7ab65cd8e8c0ad1376 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 25 Aug 2026 10:03:24 -0700
Subject: [PATCH 2/2] =?UTF-8?q?getaddrinfo:=20getaddrinfo.c=20doesn?=
 =?UTF-8?q?=E2=80=99t=20need=20gettext.h?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lib/getaddrinfo.c: Don’t include gettext.h.
(_, N_): Remove; unused.
---
 ChangeLog         | 4 ++++
 lib/getaddrinfo.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 86f7f3804e..2fbe7488ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2026-08-25  Paul Eggert  <[email protected]>
 
+	getaddrinfo: getaddrinfo.c doesn’t need gettext.h
+	* lib/getaddrinfo.c: Don’t include gettext.h.
+	(_, N_): Remove; unused.
+
 	gettext-h-tests: don’t assume ENABLE_NLS
 	* tests/test-gettext-h.c (main) [!ENABLE_NLS]:
 	Do not call textdomain, as it is not in scope.
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 2b60377bdb..c7d404535e 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -39,10 +39,6 @@
 /* Get snprintf. */
 #include <stdio.h>
 
-#include "gettext.h"
-#define _(msgid) dgettext (GNULIB_TEXT_DOMAIN, msgid)
-#define N_(msgid) msgid
-
 /* BeOS has AF_INET, but not PF_INET.  */
 #ifndef PF_INET
 # define PF_INET AF_INET
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.