# HG changeset patch # User Wolfgang Rosenauer # Date 1280908678 -7200 # Node ID 4270a8c31485249115fb5dd2f87a6bfc4aeb4325 # Parent 8fea954c3b288a9ca93ee8fbf9ac7a7016103581 honor LANGUAGE environment variable for UI locale (bmo#583793) diff -r 8fea954c3b28 -r 4270a8c31485 mozilla-locale.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mozilla-locale.patch Wed Aug 04 09:57:58 2010 +0200 @@ -0,0 +1,98 @@ +# HG changeset patch +# User Wolfgang Rosenauer +# Parent a93100d87cc9841c6e3e4b29a47bb7b91f23415f +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 + # include "nsIMacLocale.h" + #elif defined(XP_UNIX) || defined(XP_BEOS) + # include + # include + # 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) + nsAutoString category, category_platform; + nsLocale* resultLocale; + int i; + + resultLocale = new nsLocale(); + if ( resultLocale == NULL ) { + return; + } ++ ++ // 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 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 + char* lc_temp = setlocale(posix_locale_category[i], ""); + CopyASCIItoUTF16(LocaleList[i], category); +- category_platform = category; ++ category_platform = category; + category_platform.AppendLiteral("##PLATFORM"); + if (lc_temp != nsnull) { + result = posixConverter->GetXPLocale(lc_temp, xpLocale); + CopyASCIItoUTF16(lc_temp, platformLocale); + } else { +- char* lang = getenv("LANG"); + if ( lang == nsnull ) { + platformLocale.AssignLiteral("en_US"); + result = posixConverter->GetXPLocale("en-US", xpLocale); + } + else { + CopyASCIItoUTF16(lang, platformLocale); +- result = posixConverter->GetXPLocale(lang, xpLocale); ++ 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 diff -r 8fea954c3b28 -r 4270a8c31485 mozilla-xulrunner192/mozilla-locale.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mozilla-xulrunner192/mozilla-locale.patch Wed Aug 04 09:57:58 2010 +0200 @@ -0,0 +1,1 @@ +../mozilla-locale.patch \ No newline at end of file diff -r 8fea954c3b28 -r 4270a8c31485 mozilla-xulrunner192/mozilla-xulrunner192.changes --- a/mozilla-xulrunner192/mozilla-xulrunner192.changes Thu Jul 29 10:38:24 2010 +0200 +++ b/mozilla-xulrunner192/mozilla-xulrunner192.changes Wed Aug 04 09:57:58 2010 +0200 @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Aug 4 09:39:24 CEST 2010 - wr@rosenauer.org + +- honor LANGUAGE environment variable for UI locale (bmo#583793) + ------------------------------------------------------------------- Wed Jul 28 07:32:50 CEST 2010 - wr@rosenauer.org diff -r 8fea954c3b28 -r 4270a8c31485 mozilla-xulrunner192/mozilla-xulrunner192.spec --- a/mozilla-xulrunner192/mozilla-xulrunner192.spec Thu Jul 29 10:38:24 2010 +0200 +++ b/mozilla-xulrunner192/mozilla-xulrunner192.spec Wed Aug 04 09:57:58 2010 +0200 @@ -81,9 +81,10 @@ Patch11: mozilla-gconf-backend.patch Patch12: gecko-lockdown.patch Patch13: toolkit-ui-lockdown.patch +# --- Patch14: mozilla-cairo-lcd.patch -# --- Patch15: mozilla-ua-locale-pref.patch +Patch16: mozilla-locale.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires: mozilla-js192 = %{version} Requires(post): update-alternatives coreutils @@ -232,6 +233,7 @@ %patch14 -p1 # bmo#542999 %patch15 -p1 +%patch16 -p1 %build %if %suse_version >= 1110 diff -r 8fea954c3b28 -r 4270a8c31485 series --- a/series Thu Jul 29 10:38:24 2010 +0200 +++ b/series Wed Aug 04 09:57:58 2010 +0200 @@ -14,6 +14,7 @@ mozilla-ua-locale-pref.patch mozilla-esd.patch mozilla-cairo-lcd.patch +mozilla-locale.patch # Firefox patches firefox-libxul-sdk.patch