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