1 # HG changeset patch |
1 # HG changeset patch |
2 # User Wolfgang Rosenauer <wr@rosenauer.org> |
2 # User Wolfgang Rosenauer <wr@rosenauer.org> |
3 # Parent db620d83124746201970dcf50c661957df979eca |
3 # Parent 0d6917b8f28f6e0398dbf329dda4932ba4f997c2 |
4 Bug 583793 - Firefox interface language set to LANG, ignores LANGUAGE |
4 Bug 583793 - Firefox interface language set to LANG, ignores LANGUAGE |
5 |
5 |
6 diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp |
6 diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp |
7 --- a/intl/locale/src/nsLocaleService.cpp |
7 --- a/intl/locale/src/nsLocaleService.cpp |
8 +++ b/intl/locale/src/nsLocaleService.cpp |
8 +++ b/intl/locale/src/nsLocaleService.cpp |
9 @@ -181,16 +181,17 @@ nsLocaleService::nsLocaleService(void) |
9 @@ -160,16 +160,17 @@ nsLocaleService::nsLocaleService(void) |
10 } |
10 nsRefPtr<nsLocale> resultLocale(new nsLocale()); |
11 |
11 NS_ENSURE_TRUE(resultLocale, ); |
12 |
12 |
13 #ifdef MOZ_WIDGET_QT |
13 #ifdef MOZ_WIDGET_QT |
14 const char* lang = QLocale::system().name().toAscii(); |
14 const char* lang = QLocale::system().name().toAscii(); |
15 #else |
15 #else |
16 // Get system configuration |
16 // Get system configuration |
17 const char* lang = getenv("LANG"); |
17 const char* lang = getenv("LANG"); |
18 + const char* language = getenv("LANGUAGE"); |
18 + const char* language = getenv("LANGUAGE"); |
19 #endif |
19 #endif |
20 |
20 |
21 for( i = 0; i < LocaleListLength; i++ ) { |
21 nsAutoString xpLocale, platformLocale; |
22 nsresult result; |
22 nsAutoString category, category_platform; |
23 // setlocale( , "") evaluates LC_* and LANG |
23 int i; |
24 char* lc_temp = setlocale(posix_locale_category[i], ""); |
24 |
25 CopyASCIItoUTF16(LocaleList[i], category); |
25 for( i = 0; i < LocaleListLength; i++ ) { |
26 category_platform = category; |
26 nsresult result; |
27 @@ -206,16 +207,21 @@ nsLocaleService::nsLocaleService(void) |
27 @@ -188,16 +189,21 @@ nsLocaleService::nsLocaleService(void) |
28 else { |
28 } else { |
29 CopyASCIItoUTF16(lang, platformLocale); |
29 CopyASCIItoUTF16(lang, platformLocale); |
30 result = posixConverter->GetXPLocale(lang, xpLocale); |
30 result = nsPosixLocale::GetXPLocale(lang, xpLocale); |
31 } |
|
32 } |
31 } |
33 if (NS_FAILED(result)) { |
|
34 return; |
|
35 } |
|
36 + // LANGUAGE is overriding LC_MESSAGES |
|
37 + if (i == LC_MESSAGES && language && *language) { |
|
38 + CopyASCIItoUTF16(language, platformLocale); |
|
39 + result = posixConverter->GetXPLocale(language, xpLocale); |
|
40 + } |
|
41 resultLocale->AddCategory(category, xpLocale); |
|
42 resultLocale->AddCategory(category_platform, platformLocale); |
|
43 } |
32 } |
44 mSystemLocale = do_QueryInterface(resultLocale); |
33 if (NS_FAILED(result)) { |
45 mApplicationLocale = do_QueryInterface(resultLocale); |
34 return; |
46 } // if ( NS_SUCCEEDED )... |
35 } |
|
36 + // LANGUAGE is overriding LC_MESSAGES |
|
37 + if (i == LC_MESSAGES && language && *language) { |
|
38 + CopyASCIItoUTF16(language, platformLocale); |
|
39 + result = nsPosixLocale::GetXPLocale(language, xpLocale); |
|
40 + } |
|
41 resultLocale->AddCategory(category, xpLocale); |
|
42 resultLocale->AddCategory(category_platform, platformLocale); |
|
43 } |
|
44 mSystemLocale = do_QueryInterface(resultLocale); |
|
45 mApplicationLocale = do_QueryInterface(resultLocale); |
47 |
46 |
48 #endif // XP_UNIX |
47 #endif // XP_UNIX |
|
48 #ifdef XP_OS2 |