]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE
authorMatthias Klose <doko@ubuntu.com>
Tue, 20 Sep 2005 07:03:21 +0000 (07:03 +0000)
committerMatthias Klose <doko@ubuntu.com>
Tue, 20 Sep 2005 07:03:21 +0000 (07:03 +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 a23181044cae36c6131852bd6f06f2a9e142676e..c52e5d226d01a36afee6c6caf0aacf85b066937c 100644 (file)
@@ -293,7 +293,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).
@@ -338,6 +338,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 c8d62784731e9438ac4372560a610476eb136acc..cc1252dc9b66e753015151b904a0f6bbf36b1f8a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -96,6 +96,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: time.strptime() was not invalidating its regex cache when the