mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix calibre not running on linux systems that set LANG to an empty string
This commit is contained in:
parent
d28ea799f2
commit
c90199efc3
@ -27,7 +27,7 @@ def get_lang():
|
||||
from calibre.utils.config_base import prefs
|
||||
lang = prefs['language']
|
||||
lang = os.environ.get('CALIBRE_OVERRIDE_LANG', lang)
|
||||
if lang is not None:
|
||||
if lang:
|
||||
return lang
|
||||
try:
|
||||
lang = locale.getdefaultlocale(['LANGUAGE', 'LC_ALL', 'LC_CTYPE',
|
||||
@ -45,7 +45,7 @@ def get_lang():
|
||||
lang = match.group()
|
||||
if lang == 'zh':
|
||||
lang = 'zh_CN'
|
||||
if lang is None:
|
||||
if not lang:
|
||||
lang = 'en'
|
||||
return lang
|
||||
|
||||
@ -68,6 +68,8 @@ def set_translators():
|
||||
# To test different translations invoke as
|
||||
# CALIBRE_OVERRIDE_LANG=de_DE.utf8 program
|
||||
lang = get_lang()
|
||||
t = None
|
||||
|
||||
if lang:
|
||||
buf = iso639 = None
|
||||
mpath = get_lc_messages_path(lang)
|
||||
@ -97,7 +99,6 @@ def set_translators():
|
||||
except:
|
||||
pass # No iso639 translations for this lang
|
||||
|
||||
t = None
|
||||
if buf is not None:
|
||||
t = GNUTranslations(buf)
|
||||
if iso639 is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user