ignore empty LANGUAGE environment variable (bnc#648854) mozilla-1.9.2
authorWolfgang Rosenauer <wr@rosenauer.org>
Mon, 25 Oct 2010 13:03:51 +0200
branchmozilla-1.9.2
changeset 184 e398c79b1668
parent 183 15e53a96c9ca
child 188 62645c4a1e68
ignore empty LANGUAGE environment variable (bnc#648854)
mozilla-locale.patch
mozilla-xulrunner192/mozilla-xulrunner192.changes
--- a/mozilla-locale.patch	Mon Oct 25 10:06:05 2010 +0200
+++ b/mozilla-locale.patch	Mon Oct 25 13:03:51 2010 +0200
@@ -1,32 +1,12 @@
 # HG changeset patch
 # User Wolfgang Rosenauer <wr@rosenauer.org>
-# Parent a93100d87cc9841c6e3e4b29a47bb7b91f23415f
+# Parent e069ee20084757311e0826e68d5a1fbeb3dcc29f
 Bug 583793 - Firefox interface language set to LANG, ignores LANGUAGE
 
 diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp
 --- a/intl/locale/src/nsLocaleService.cpp
 +++ b/intl/locale/src/nsLocaleService.cpp
-@@ -55,16 +55,19 @@
- #  include "nsIOS2Locale.h"
- #elif defined(XP_MACOSX)
- #  include <Carbon/Carbon.h>
- #  include "nsIMacLocale.h"
- #elif defined(XP_UNIX) || defined(XP_BEOS)
- #  include <locale.h>
- #  include <stdlib.h>
- #  include "nsIPosixLocale.h"
-+#if (MOZ_PLATFORM_MAEMO >= 6)
-+#  include "nsIGConfService.h"
-+#endif
- #endif
- 
- //
- // implementation constants
- const int LocaleListLength = 6;
- const char* LocaleList[LocaleListLength] = 
- {
- 	NSILOCALE_COLLATE,
-@@ -169,39 +172,66 @@ nsLocaleService::nsLocaleService(void)
+@@ -169,39 +169,48 @@ nsLocaleService::nsLocaleService(void)
          nsAutoString category, category_platform;
          nsLocale* resultLocale;
          int i;
@@ -39,24 +19,6 @@
 +        // Get system configuration
 +        char* language = getenv("LANGUAGE");
 +        char* lang = getenv("LANG");
-+#if (MOZ_PLATFORM_MAEMO >= 6)
-+        // GConf key is treated as LANG _and_ LANGUAGE
-+        nsCAutoString gconfLocaleString;
-+        nsresult rv;
-+        nsCOMPtr<nsIGConfService> gconf =
-+            do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv);
-+        if (NS_SUCCEEDED(rv)) {
-+            rv = gconf->GetString(NS_LITERAL_CSTRING("/meegotouch/i18n/language"),
-+                                  gconfLocaleString);
-+            if (NS_SUCCEEDED(rv) && !gconfLocaleString.IsEmpty()) {
-+                lang = gconfLocaleString.get();
-+                language = gconfLocaleString.get();
-+                // For setlocale() doing the right thing we need to export
-+                // this as LANG to the environment
-+                setenv("LANG", lang, 1);
-+            }
-+        }
-+#endif
          for( i = 0; i < LocaleListLength; i++ ) {
              nsresult result;
 +            // setlocale( , "") evaluates LC_* and LANG
@@ -84,7 +46,7 @@
                  return;
              }
 +            // LANGUAGE is overriding LC_MESSAGES
-+            if (i == LC_MESSAGES && language) {
++            if (i == LC_MESSAGES && language && *language) {
 +                CopyASCIItoUTF16(language, platformLocale);
 +                result = posixConverter->GetXPLocale(language, xpLocale);
 +            }
--- a/mozilla-xulrunner192/mozilla-xulrunner192.changes	Mon Oct 25 10:06:05 2010 +0200
+++ b/mozilla-xulrunner192/mozilla-xulrunner192.changes	Mon Oct 25 13:03:51 2010 +0200
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Mon Oct 25 10:09:54 CEST 2010 - wr@rosenauer.org
+
+- ignore empty LANGUAGE environment variable (bnc#648854)
+
 -------------------------------------------------------------------
 Wed Oct  6 07:13:34 CEST 2010 - wr@rosenauer.org