aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-12-12 09:45:16 +0100
committerFlorian Weimer <fweimer@redhat.com>2023-12-12 10:08:07 +0100
commitd0aefec49941cf6d97e2244d6aa20bafc26d5942 (patch)
tree564b5193cbe036929f80c8779bee53983ba8528b
parentfc039ce8502d236f11074eb58468be24b4fa8cc7 (diff)
downloadglibc-d0aefec49941cf6d97e2244d6aa20bafc26d5942.tar
glibc-d0aefec49941cf6d97e2244d6aa20bafc26d5942.tar.gz
glibc-d0aefec49941cf6d97e2244d6aa20bafc26d5942.tar.bz2
glibc-d0aefec49941cf6d97e2244d6aa20bafc26d5942.zip
intl: Treat C.UTF-8 locale like C locale, part 2 (BZ# 16621)
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>
-rw-r--r--intl/dcigettext.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index 27063886d2..fb69bbf94b 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -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;