Skip to content
Snippets Groups Projects
Commit faccf1e3 authored by nkour's avatar nkour
Browse files

use better varnames [PEP8 says varnames such as l are way bad for maintability...

use better varnames [PEP8 says varnames such as l are way bad for maintability and high readability, comment the code, cleanup so it does not hide logic. thanks Yann for explaining the logic
parent e85c373a
No related branches found
No related tags found
No related merge requests found
......@@ -36,16 +36,20 @@ else:
# set '' so each part of the locale that should be modified is set
# according to the environment variables
locale.setlocale(locale.LC_ALL, '')
# Add LANG to os.environ
l = os.environ.get('LANG')
if not l:
l = ''
default_l = locale.getdefaultlocale()[0]
if not default_l in l.split(':'):
l += ':' + default_l
if l[0] == ':': #remove the forst :
l = l[1:]
os.environ['LANG'] = l
## Add LANG to os.environ ##
# get LANG, fallback to ''; LANG can be 'en_US:el_GR.UTF-8:fr_FR'
lang = os.environ.get('LANG', '')
default_loc = locale.getdefaultlocale()[0] # en_US, fr_FR, el_GR etc..
if default_loc not in lang.split(':'): # is the default locale a value of LANG?
# no, add it!
if lang == '':
lang = default_loc
else:
lang += ':' + default_loc
os.environ['LANG'] = lang
_translation = None
def init():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment