mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
- 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.
This commit is contained in:
parent
ba3e6ec0c9
commit
f3f231f60c
2 changed files with 9 additions and 1 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue