mozilla-language.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Sun, 03 Nov 2013 18:39:18 +0100
branchesr24
changeset 684 7627f28354d4
parent 650 e8c83b144fd1
child 718 6cb1ac7cd223
permissions -rw-r--r--
changelog
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
161
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
# HG changeset patch
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
# User Wolfgang Rosenauer <wr@rosenauer.org>
650
e8c83b144fd1 22.0b4 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
     3
# Parent df748bfc0eaca6dedf086cfd7167392416bfae27
161
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
Bug 583793 - Firefox interface language set to LANG, ignores LANGUAGE
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
--- a/intl/locale/src/nsLocaleService.cpp
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
+++ b/intl/locale/src/nsLocaleService.cpp
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
     9
@@ -127,16 +127,17 @@ nsLocaleService::nsLocaleService(void)
294
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    10
     nsRefPtr<nsLocale> resultLocale(new nsLocale());
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    11
     NS_ENSURE_TRUE_VOID(resultLocale);
229
298263f797be update to 2.0b12/4.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 185
diff changeset
    12
 
298263f797be update to 2.0b12/4.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 185
diff changeset
    13
 #ifdef MOZ_WIDGET_QT
650
e8c83b144fd1 22.0b4 update
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
    14
     const char* lang = QLocale::system().name().toUtf8();
229
298263f797be update to 2.0b12/4.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 185
diff changeset
    15
 #else
294
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    16
     // Get system configuration
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    17
     const char* lang = getenv("LANG");
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    18
+    const char* language = getenv("LANGUAGE");
161
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
 #endif
229
298263f797be update to 2.0b12/4.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 185
diff changeset
    20
 
294
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    21
     nsAutoString xpLocale, platformLocale;
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    22
     nsAutoString category, category_platform;
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    23
     int i;
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    24
 
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    25
     for( i = 0; i < LocaleListLength; i++ ) {
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    26
         nsresult result;
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 294
diff changeset
    27
@@ -155,16 +156,21 @@ nsLocaleService::nsLocaleService(void)
294
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    28
             } else {
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    29
                 CopyASCIItoUTF16(lang, platformLocale);
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    30
                 result = nsPosixLocale::GetXPLocale(lang, xpLocale);
161
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
             }
294
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    32
         }
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    33
         if (NS_FAILED(result)) {
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    34
             return;
161
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
         }
294
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    36
+        // LANGUAGE is overriding LC_MESSAGES
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    37
+        if (i == LC_MESSAGES && language && *language) {
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    38
+          CopyASCIItoUTF16(language, platformLocale);
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    39
+          result = nsPosixLocale::GetXPLocale(language, xpLocale);
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    40
+        }
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    41
         resultLocale->AddCategory(category, xpLocale);
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    42
         resultLocale->AddCategory(category_platform, platformLocale);
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    43
     }
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    44
     mSystemLocale = do_QueryInterface(resultLocale);
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    45
     mApplicationLocale = do_QueryInterface(resultLocale);
161
a6dc70babb5f honour LANGUAGE environment variable (bmo#583793)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
        
251
4c9ebbedd59c adopt patches to new base
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 229
diff changeset
    47
 #endif // XP_UNIX
294
5330447b83a3 update to aurora (6.99 / 20110721)
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 251
diff changeset
    48
 #ifdef XP_OS2