]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
intl: Treat C.UTF-8 locale like C locale, part 2 (BZ# 16621)
authorBruno Haible <bruno@clisp.org>
Tue, 12 Dec 2023 08:45:16 +0000 (09:45 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 12 Dec 2023 09:08:07 +0000 (10:08 +0100)
The previous commit was incomplete: gettext() still returns a translation
if the file /usr/share/locale/C/LC_MESSAGES/<domain>.mo exists. This patch
prohibits the translation also in this case.

* gettext-runtime/intl/dcigettext.c (DCIGETTEXT): Treat C.<encoding> locale
like the C locale.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
intl/dcigettext.c

index 27063886d2e83f59cfa83400c0e36e664862ab9f..fb69bbf94b089beb5d29d3a90571bd75917f7e72 100644 (file)
@@ -691,9 +691,10 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
            continue;
        }
 
-      /* If the current locale value is C (or POSIX) we don't load a
-        domain.  Return the MSGID.  */
-      if (strcmp (single_locale, "C") == 0
+      /* If the current locale value is "C" or "C.<encoding>" or "POSIX",
+        we don't load a domain.  Return the MSGID.  */
+      if ((single_locale[0] == 'C'
+          && (single_locale[1] == '\0' || single_locale[1] == '.'))
          || strcmp (single_locale, "POSIX") == 0)
        break;