Handle LC_ALL=C correctly

We default to 'en' for LANG if LC_ALL=C is set
This commit is contained in:
Philipp Hörist 2018-05-17 20:01:31 +02:00
parent 2a8c0da367
commit 03aa1db306
1 changed files with 4 additions and 1 deletions

View File

@ -68,7 +68,10 @@ def initialize_lang():
global LANG global LANG
try: try:
# en_US, fr_FR, el_GR etc.. # en_US, fr_FR, el_GR etc..
LANG = locale.getdefaultlocale()[0] default = locale.getdefaultlocale()[0]
if default is None:
# LC_ALL=C
return
LANG = LANG[:2] LANG = LANG[:2]
except (ValueError, locale.Error): except (ValueError, locale.Error):
pass pass