environment variable can contain only one language. Fixes #1606
This commit is contained in:
parent
042fb8e0df
commit
9991a13dcc
|
@ -37,17 +37,13 @@ else:
|
||||||
# according to the environment variables
|
# according to the environment variables
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
|
||||||
## Add, if needed, a value in LANG environmental variable ##
|
## Set, if needed, a value in LANG environmental variable ##
|
||||||
# get LANG, fallback to ''; LANG can be 'en_US:el_GR.UTF-8:fr_FR'
|
# get LANG, fallback to ''
|
||||||
lang = os.environ.get('LANG', '')
|
lang = os.environ.get('LANG')
|
||||||
default_loc = locale.getdefaultlocale()[0] # en_US, fr_FR, el_GR etc..
|
if not lang:
|
||||||
# is the default locale a value of LANG?
|
default_lang = locale.getdefaultlocale()[0] # en_US, fr_FR, el_GR etc..
|
||||||
if default_loc and default_loc not in lang.split(':'):
|
if default_lang:
|
||||||
# no, add it!
|
lang = default_lang
|
||||||
if lang == '':
|
|
||||||
lang = default_loc
|
|
||||||
else:
|
|
||||||
lang += ':' + default_loc
|
|
||||||
|
|
||||||
if lang:
|
if lang:
|
||||||
os.environ['LANG'] = lang
|
os.environ['LANG'] = lang
|
||||||
|
|
Loading…
Reference in New Issue