honour LANGUAGE environment variable (bmo#583793)
authorWolfgang Rosenauer <wr@rosenauer.org>
Wed, 29 Sep 2010 14:11:58 +0200
changeset 161 a6dc70babb5f
parent 157 6f59409302d1
child 162 1a5d5532d5be
child 164 995e803e8198
honour LANGUAGE environment variable (bmo#583793)
mozilla-language.patch
mozilla-xulrunner20/mozilla-language.patch
mozilla-xulrunner20/mozilla-xulrunner20.changes
mozilla-xulrunner20/mozilla-xulrunner20.spec
series
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-language.patch	Wed Sep 29 14:11:58 2010 +0200
@@ -0,0 +1,55 @@
+# HG changeset patch
+# User Wolfgang Rosenauer <wr@rosenauer.org>
+# Parent 6272ce1da6f587a7f29aa9e1f55d5983af413c0e
+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
+@@ -192,22 +192,24 @@ nsLocaleService::nsLocaleService(void)
+             return; 
+         }
+ 
+ #ifdef MOZ_ENABLE_MEEGOTOUCH
+         // Create a snapshot of the gconf locale values into the
+         // corresponding environment variables to obey system settings
+         // as accurately as possible.
+         CopyGConfToEnv("/meegotouch/i18n/language", "LANG");
++        CopyGConfToEnv("/meegotouch/i18n/language", "LANGUAGE");
+         CopyGConfToEnv("/meegotouch/i18n/lc_collate", NSILOCALE_COLLATE);
+         CopyGConfToEnv("/meegotouch/i18n/lc_monetary", NSILOCALE_MONETARY);
+         CopyGConfToEnv("/meegotouch/i18n/lc_numeric", NSILOCALE_NUMERIC);
+         CopyGConfToEnv("/meegotouch/i18n/lc_time", NSILOCALE_TIME);
+ #endif
+         // Get system configuration
++        const char* language = getenv("LANGUAGE");
+         const char* lang = getenv("LANG");
+         for( i = 0; i < LocaleListLength; i++ ) {
+             nsresult result;
+             // setlocale( , "") evaluates LC_* and LANG
+             char* lc_temp = setlocale(posix_locale_category[i], "");
+             CopyASCIItoUTF16(LocaleList[i], category);
+             category_platform = category;
+             category_platform.AppendLiteral("##PLATFORM");
+@@ -222,16 +224,21 @@ nsLocaleService::nsLocaleService(void)
+                 else {
+                     CopyASCIItoUTF16(lang, platformLocale);
+                     result = posixConverter->GetXPLocale(lang, xpLocale);
+                 }
+             }
+             if (NS_FAILED(result)) {
+                 return;
+             }
++            // LANGUAGE is overriding LC_MESSAGES
++            if (i == LC_MESSAGES && language) {
++                CopyASCIItoUTF16(language, platformLocale);
++                result = posixConverter->GetXPLocale(language, xpLocale);
++            }
+             resultLocale->AddCategory(category, xpLocale);
+             resultLocale->AddCategory(category_platform, platformLocale);
+         }
+         mSystemLocale = do_QueryInterface(resultLocale);
+         mApplicationLocale = do_QueryInterface(resultLocale);
+     }  // if ( NS_SUCCEEDED )...
+        
+ #endif // XP_UNIX || XP_BEOS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-xulrunner20/mozilla-language.patch	Wed Sep 29 14:11:58 2010 +0200
@@ -0,0 +1,1 @@
+../mozilla-language.patch
\ No newline at end of file
--- a/mozilla-xulrunner20/mozilla-xulrunner20.changes	Fri Sep 03 16:26:10 2010 +0200
+++ b/mozilla-xulrunner20/mozilla-xulrunner20.changes	Wed Sep 29 14:11:58 2010 +0200
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Wed Sep 29 14:10:28 CEST 2010 - wr@rosenauer.org
+
+- honour LANGUAGE environment variable (bmo#583793)
+
 -------------------------------------------------------------------
 Wed Jul 28 07:06:08 CEST 2010 - wr@rosenauer.org
 
--- a/mozilla-xulrunner20/mozilla-xulrunner20.spec	Fri Sep 03 16:26:10 2010 +0200
+++ b/mozilla-xulrunner20/mozilla-xulrunner20.spec	Wed Sep 29 14:11:58 2010 +0200
@@ -71,6 +71,7 @@
 # ---
 Patch11:        mozilla-cpuid.patch
 Patch12:        mozilla-buildsymbols.patch
+Patch13:        mozilla-language.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires:       mozilla-js20 = %{version}
 Requires(post):  update-alternatives coreutils
@@ -211,6 +212,7 @@
 %patch11 -p1
 %endif
 %patch12 -p1
+%patch13 -p1
 
 %build
 kdehelperversion=$(cat toolkit/xre/nsKDEUtils.cpp | grep '#define KMOZILLAHELPER_VERSION' | cut -d ' ' -f 3)
--- a/series	Fri Sep 03 16:26:10 2010 +0200
+++ b/series	Wed Sep 29 14:11:58 2010 +0200
@@ -12,6 +12,7 @@
 mozilla-cpuid.patch
 mozilla-buildsymbols.patch
 #mozilla-cairo-lcd.patch
+mozilla-language.patch
 
 # Firefox patches
 firefox-libxul-sdk.patch