|
1 # HG changeset patch |
|
2 # User Wolfgang Rosenauer <wr@rosenauer.org> |
|
3 # Parent 6272ce1da6f587a7f29aa9e1f55d5983af413c0e |
|
4 Bug 583793 - Firefox interface language set to LANG, ignores LANGUAGE |
|
5 |
|
6 diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp |
|
7 --- a/intl/locale/src/nsLocaleService.cpp |
|
8 +++ b/intl/locale/src/nsLocaleService.cpp |
|
9 @@ -192,22 +192,24 @@ nsLocaleService::nsLocaleService(void) |
|
10 return; |
|
11 } |
|
12 |
|
13 #ifdef MOZ_ENABLE_MEEGOTOUCH |
|
14 // Create a snapshot of the gconf locale values into the |
|
15 // corresponding environment variables to obey system settings |
|
16 // as accurately as possible. |
|
17 CopyGConfToEnv("/meegotouch/i18n/language", "LANG"); |
|
18 + CopyGConfToEnv("/meegotouch/i18n/language", "LANGUAGE"); |
|
19 CopyGConfToEnv("/meegotouch/i18n/lc_collate", NSILOCALE_COLLATE); |
|
20 CopyGConfToEnv("/meegotouch/i18n/lc_monetary", NSILOCALE_MONETARY); |
|
21 CopyGConfToEnv("/meegotouch/i18n/lc_numeric", NSILOCALE_NUMERIC); |
|
22 CopyGConfToEnv("/meegotouch/i18n/lc_time", NSILOCALE_TIME); |
|
23 #endif |
|
24 // Get system configuration |
|
25 + const char* language = getenv("LANGUAGE"); |
|
26 const char* lang = getenv("LANG"); |
|
27 for( i = 0; i < LocaleListLength; i++ ) { |
|
28 nsresult result; |
|
29 // setlocale( , "") evaluates LC_* and LANG |
|
30 char* lc_temp = setlocale(posix_locale_category[i], ""); |
|
31 CopyASCIItoUTF16(LocaleList[i], category); |
|
32 category_platform = category; |
|
33 category_platform.AppendLiteral("##PLATFORM"); |
|
34 @@ -222,16 +224,21 @@ nsLocaleService::nsLocaleService(void) |
|
35 else { |
|
36 CopyASCIItoUTF16(lang, platformLocale); |
|
37 result = posixConverter->GetXPLocale(lang, xpLocale); |
|
38 } |
|
39 } |
|
40 if (NS_FAILED(result)) { |
|
41 return; |
|
42 } |
|
43 + // LANGUAGE is overriding LC_MESSAGES |
|
44 + if (i == LC_MESSAGES && language) { |
|
45 + CopyASCIItoUTF16(language, platformLocale); |
|
46 + result = posixConverter->GetXPLocale(language, xpLocale); |
|
47 + } |
|
48 resultLocale->AddCategory(category, xpLocale); |
|
49 resultLocale->AddCategory(category_platform, platformLocale); |
|
50 } |
|
51 mSystemLocale = do_QueryInterface(resultLocale); |
|
52 mApplicationLocale = do_QueryInterface(resultLocale); |
|
53 } // if ( NS_SUCCEEDED )... |
|
54 |
|
55 #endif // XP_UNIX || XP_BEOS |