public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] intl: Treat C.UTF-8 locale like C locale, part 2 (BZ# 16621)
Date: Tue, 12 Dec 2023 09:08:30 +0000 (GMT)	[thread overview]
Message-ID: <20231212090830.A2747385C6DE@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d0aefec49941cf6d97e2244d6aa20bafc26d5942

commit d0aefec49941cf6d97e2244d6aa20bafc26d5942
Author: Bruno Haible <bruno@clisp.org>
Date:   Tue Dec 12 09:45:16 2023 +0100

    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>

Diff:
---
 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;

                 reply	other threads:[~2023-12-12  9:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231212090830.A2747385C6DE@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).