Fix #789247 (Calibre has a problem with my locale)

This commit is contained in:
Kovid Goyal 2011-05-27 12:58:37 -06:00
parent 6d89193f52
commit 82021c246f

View File

@ -29,8 +29,11 @@ def get_lang():
lang = os.environ.get('CALIBRE_OVERRIDE_LANG', lang) lang = os.environ.get('CALIBRE_OVERRIDE_LANG', lang)
if lang is not None: if lang is not None:
return lang return lang
try:
lang = locale.getdefaultlocale(['LANGUAGE', 'LC_ALL', 'LC_CTYPE', lang = locale.getdefaultlocale(['LANGUAGE', 'LC_ALL', 'LC_CTYPE',
'LC_MESSAGES', 'LANG'])[0] 'LC_MESSAGES', 'LANG'])[0]
except:
pass # This happens on Ubuntu apparently
if lang is None and os.environ.has_key('LANG'): # Needed for OS X if lang is None and os.environ.has_key('LANG'): # Needed for OS X
try: try:
lang = os.environ['LANG'] lang = os.environ['LANG']