MozillaFirefox/mozilla-language.patch

49 lines
1.9 KiB
Diff

# HG changeset patch
# User Wolfgang Rosenauer <wr@rosenauer.org>
# Parent db620d83124746201970dcf50c661957df979eca
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
@@ -181,16 +181,17 @@ nsLocaleService::nsLocaleService(void)
}
#ifdef MOZ_WIDGET_QT
const char* lang = QLocale::system().name().toAscii();
#else
// Get system configuration
const char* lang = getenv("LANG");
+ const char* language = getenv("LANGUAGE");
#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;
@@ -206,16 +207,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 && *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