diff --git a/src/common/i18n.py b/src/common/i18n.py index 16a452a57..29c99bf8e 100644 --- a/src/common/i18n.py +++ b/src/common/i18n.py @@ -37,17 +37,13 @@ else: # according to the environment variables locale.setlocale(locale.LC_ALL, '') -## Add, if needed, a value in LANG environmental variable ## -# 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.. -# is the default locale a value of LANG? -if default_loc and default_loc not in lang.split(':'): - # no, add it! - if lang == '': - lang = default_loc - else: - lang += ':' + default_loc +## Set, if needed, a value in LANG environmental variable ## +# get LANG, fallback to '' +lang = os.environ.get('LANG') +if not lang: + default_lang = locale.getdefaultlocale()[0] # en_US, fr_FR, el_GR etc.. + if default_lang: + lang = default_lang if lang: os.environ['LANG'] = lang