public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] intl: Treat C.UTF-8 locale like C locale, part 2 (BZ# 16621)
@ 2023-09-10 19:17 Bruno Haible
  2023-09-11  7:43 ` Florian Weimer
  2023-12-12  9:08 ` Florian Weimer
  0 siblings, 2 replies; 4+ messages in thread
From: Bruno Haible @ 2023-09-10 19:17 UTC (permalink / raw)
  To: libc-alpha; +Cc: Bruno Haible

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.
---
 intl/dcigettext.c | 7 ++++---
 1 file 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;
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-12  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-10 19:17 [PATCH] intl: Treat C.UTF-8 locale like C locale, part 2 (BZ# 16621) Bruno Haible
2023-09-11  7:43 ` Florian Weimer
2023-09-12 14:44   ` Bruno Haible
2023-12-12  9:08 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).