From d0aefec49941cf6d97e2244d6aa20bafc26d5942 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 12 Dec 2023 09:45:16 +0100 Subject: 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/.mo exists. This patch prohibits the translation also in this case. * gettext-runtime/intl/dcigettext.c (DCIGETTEXT): Treat C. locale like the C locale. Reviewed-by: Florian Weimer --- intl/dcigettext.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/intl/dcigettext.c b/intl/dcigettext.c index 2706388..fb69bbf 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." 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; -- cgit v1.1