bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] cygwin started speaking German today


From: Bruno Haible
Subject: Re: [bug-gettext] cygwin started speaking German today
Date: Thu, 8 Sep 2011 23:44:55 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Charles Wilson wrote:
> Here's how to reproduce:
> 
> $ LANG=C.UTF-8 DISPLAY=127.0.0.1:0.0 xterm &
> $ LC_ALL=C.UTF-8 DISPLAY=127.0.0.1:0.0 xterm &
> 
> In the first xterm:
> 
> $ mkdir -v x1
> mkdir: Verzeichnis „x1“ angelegt
> 
> In the seccond xterm:
> 
> $ mkdir -v x2
> mkdir: created directory `x2'
> 
> Now, it may be possible to simplify this test case

Yes, I reproduce it without an xterm:

$ LANG=C.UTF-8 bash
$ mkdir -v x1; rmdir x1
mkdir: Verzeichnis „x1“ angelegt

whereas

$ LC_ALL=C.UTF-8 bash
$ mkdir -v x1; rmdir x1
mkdir: created directory `x1'

Find below a patch which ought to fix this. But it has upsides and downsides.
The upside: It treats LC_ALL, LC_$category, LANG consistently, like POSIX
wants it.
The downside: It makes libintl_setlocale's behaviour diverge a little more from
Cygwin's setlocale behaviour.
Should I commit the patch or not?

Bruno


2011-09-08  Bruno Haible  <address@hidden>

        * lib/localename.c (gl_locale_name_environ) [CYGWIN]: Treat
        LC_ALL=C.UTF-8 and LC_XXX=C.UTF-8 the same way as LANG=C.UTF-8.
        Reported by Charles Wilson <address@hidden>.

--- lib/localename.c.orig       Thu Sep  8 23:34:52 2011
+++ lib/localename.c    Thu Sep  8 23:32:04 2011
@@ -2810,25 +2810,39 @@
   /* Setting of LC_ALL overrides all other.  */
   retval = getenv ("LC_ALL");
   if (retval != NULL && retval[0] != '\0')
-    return retval;
+    {
+#if defined __CYGWIN__
+      /* Cygwin.  Treat LC_ALL=C.UTF-8 like LANG=C.UTF-8, for consistency.  */
+      if (strcmp (retval, "C.UTF-8") == 0)
+        return NULL;
+#endif
+      return retval;
+    }
   /* Next comes the name of the desired category.  */
   retval = getenv (categoryname);
   if (retval != NULL && retval[0] != '\0')
-    return retval;
+    {
+#if defined __CYGWIN__
+      /* Cygwin.  Treat LC_XXX=C.UTF-8 like LANG=C.UTF-8, for consistency.  */
+      if (strcmp (retval, "C.UTF-8") == 0)
+        return NULL;
+#endif
+      return retval;
+    }
   /* Last possibility is the LANG environment variable.  */
   retval = getenv ("LANG");
   if (retval != NULL && retval[0] != '\0')
     {
+#if defined __CYGWIN__
+      /* Cygwin.  Ignore dummy LANG value set by ~/.profile.  */
+      if (strcmp (retval, "C.UTF-8") == 0)
+        return NULL;
+#endif
 #if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE
       /* MacOS X 10.2 or newer.
          Ignore invalid LANG value set by the Terminal application.  */
       if (strcmp (retval, "UTF-8") != 0)
 #endif
-#if defined __CYGWIN__
-      /* Cygwin.
-         Ignore dummy LANG value set by ~/.profile.  */
-      if (strcmp (retval, "C.UTF-8") != 0)
-#endif
         return retval;
     }
 

-- 
In memoriam Elisabeth von Thadden 
<http://en.wikipedia.org/wiki/Elisabeth_von_Thadden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]