mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Choose English as the User interface language when a locale related environment variable is set to the C locale
Merge branch 'lc-messages-c' of https://github.com/vmiklos/calibre
This commit is contained in:
commit
46d7dcdde9
@ -45,8 +45,16 @@ def get_system_locale():
|
||||
traceback.print_exc()
|
||||
if lang is None:
|
||||
try:
|
||||
lang = locale.getdefaultlocale(['LANGUAGE', 'LC_ALL', 'LC_CTYPE',
|
||||
'LC_MESSAGES', 'LANG'])[0]
|
||||
envvars = ['LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LC_MESSAGES', 'LANG']
|
||||
lang = locale.getdefaultlocale(envvars)[0]
|
||||
|
||||
# lang is None in two cases: either the environment variable is not
|
||||
# set or it's "C". Stop looking for a language in the latter case.
|
||||
if lang is None:
|
||||
for var in envvars:
|
||||
if os.environ.get(var) == 'C':
|
||||
lang = 'en_US'
|
||||
break
|
||||
except:
|
||||
pass # This happens on Ubuntu apparently
|
||||
if lang is None and 'LANG' in os.environ: # Needed for OS X
|
||||
|
Loading…
x
Reference in New Issue
Block a user