summaryrefslogtreecommitdiff
path: root/Lib/locale.py
diff options
context:
space:
mode:
authorMatthias Klose <doko@ubuntu.com>2005-09-20 07:02:49 +0000
committerMatthias Klose <doko@ubuntu.com>2005-09-20 07:02:49 +0000
commit755cbaf05c8c665ef57bb680dc612f4f445cb19b (patch)
tree6e904e57669233e05ff624eebc5379b30d1c38fe /Lib/locale.py
parent2a4df017d245d536eb37c61f66a23bf2688abaf0 (diff)
downloadcpython-755cbaf05c8c665ef57bb680dc612f4f445cb19b.tar.gz
- 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.
Diffstat (limited to 'Lib/locale.py')
-rw-r--r--Lib/locale.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/locale.py b/Lib/locale.py
index bf799529a4..e4d6023105 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -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'