diff options
author | Matthias Klose <doko@ubuntu.com> | 2005-09-20 07:02:49 (GMT) |
---|---|---|
committer | Matthias Klose <doko@ubuntu.com> | 2005-09-20 07:02:49 (GMT) |
commit | f3f231f60cd59e9e1bceccde11a1997054a73113 (patch) | |
tree | f07230b0c31fd36a4a95148cf386c18728c9cb42 /Lib | |
parent | ba3e6ec0c9928000e796090b6df70cccd0d6f385 (diff) | |
download | cpython-f3f231f60cd59e9e1bceccde11a1997054a73113.zip cpython-f3f231f60cd59e9e1bceccde11a1997054a73113.tar.gz cpython-f3f231f60cd59e9e1bceccde11a1997054a73113.tar.bz2 |
- 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')
-rw-r--r-- | Lib/locale.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/locale.py b/Lib/locale.py index bf79952..e4d6023 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' |