From: Bruno Haible <bruno@clisp.org>
Date: Mon, 9 Dec 2024 12:31:23 +0000 (+0100)
Subject: unicodeio: Use the translation domain "gnulib".
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=22fb9dcebb1249d1ec7cf5e9b62c1b95b1f25254;p=gnulib.git

unicodeio: Use the translation domain "gnulib".

* lib/unicodeio.h (unicode_to_mb): Clarify that the message passed to
the failure callback may already be localized.
* lib/unicodeio.c (unicode_to_mb): For the messages defined in this
file, use the translation domain "gnulib".
---

diff --git a/ChangeLog b/ChangeLog
index f05fb1e315..64c1723734 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-12-09  Bruno Haible  <bruno@clisp.org>
 
+	unicodeio: Use the translation domain "gnulib".
+	* lib/unicodeio.h (unicode_to_mb): Clarify that the message passed to
+	the failure callback may already be localized.
+	* lib/unicodeio.c (unicode_to_mb): For the messages defined in this
+	file, use the translation domain "gnulib".
+
 	file-type: Use the translation domain "gnulib".
 	* lib/file-type.c (file_type): Use the translation domain "gnulib".
 	* modules/file-type (Depends-on): Add gnulib-i18n.
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 1c7503ad58..876fb353d0 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -57,7 +57,7 @@
 /* Converts the Unicode character CODE to its multibyte representation
    in the current locale and calls the SUCCESS callback on the resulting
    byte sequence.  If an error occurs, invokes the FAILURE callback instead,
-   passing it CODE and an English error string.
+   passing it CODE and an English (or already localized) error string.
    Returns whatever the callback returned.
    Assumes that the locale doesn't change between two calls.  */
 long
@@ -99,16 +99,16 @@ unicode_to_mb (unsigned int code,
     {
 #if HAVE_ICONV
       if (utf8_to_local == (iconv_t)(-1))
-        return failure (code, N_("iconv function not usable"), callback_arg);
+        return failure (code, _("iconv function not usable"), callback_arg);
 #else
-      return failure (code, N_("iconv function not available"), callback_arg);
+      return failure (code, _("iconv function not available"), callback_arg);
 #endif
     }
 
   /* Convert the character to UTF-8.  */
   count = u8_uctomb ((unsigned char *) inbuf, code, sizeof (inbuf));
   if (count < 0)
-    return failure (code, N_("character out of range"), callback_arg);
+    return failure (code, _("character out of range"), callback_arg);
 
 #if HAVE_ICONV
   if (!is_utf8)
diff --git a/lib/unicodeio.h b/lib/unicodeio.h
index 0db1d35f52..a5115885b6 100644
--- a/lib/unicodeio.h
+++ b/lib/unicodeio.h
@@ -29,7 +29,7 @@ extern "C" {
 /* Converts the Unicode character CODE to its multibyte representation
    in the current locale and calls the SUCCESS callback on the resulting
    byte sequence.  If an error occurs, invokes the FAILURE callback instead,
-   passing it CODE and an English error string.
+   passing it CODE and an English (or already localized) error string.
    Returns whatever the callback returned.
    Assumes that the locale doesn't change between two calls.  */
 extern long unicode_to_mb (unsigned int code,