]> granicus.if.org Git - python/commitdiff
- Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE
authorMatthias Klose <doko@ubuntu.com>
Tue, 20 Sep 2005 07:02:49 +0000 (07:02 +0000)
committerMatthias Klose <doko@ubuntu.com>
Tue, 20 Sep 2005 07:02:49 +0000 (07:02 +0000)
  to get the correct encoding.

- Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of
  languages.

Lib/locale.py
Misc/NEWS

index bf799529a46034ee4d11d2a0e5905e716457ff01..e4d6023105e0525fe6538f2ffdae70541a6c97d4 100644 (file)
@@ -306,7 +306,7 @@ def _build_localename(localetuple):
     else:
         return language + '.' + encoding
 
-def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
+def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
 
     """ Tries to determine the default locale settings and returns
         them as tuple (language code, encoding).
@@ -351,6 +351,8 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
     for variable in envvars:
         localename = lookup(variable,None)
         if localename:
+            if variable == 'LANGUAGE':
+                localename = localename.split(':')[0]
             break
     else:
         localename = 'C'
index a3892fb1723b23312b6ff4e8856a08af54237968..ce35555580d67e01b25d783afdd1ee404880b40c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -224,6 +224,12 @@ Extension Modules
 Library
 -------
 
+- Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE
+  to get the correct encoding.
+
+- Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of
+  languages.
+
 - Patch #1268314: Cache lines in StreamReader.readlines for performance.
 
 - Bug #1290505: Fix clearing the regex cache for time.strptime().