Small fix for systems (i.e. my 12.04 LTS) that don't set LANGUAGE for whatever reason. This breaks the manual lookup

This commit is contained in:
Stephen Boddy 2015-08-08 05:21:59 +02:00
parent 10529c899a
commit 5fe91b66b1
1 changed files with 8 additions and 7 deletions

View File

@ -87,13 +87,14 @@ def has_ancestor(widget, wtype):
def manual_lookup(): def manual_lookup():
'''Choose the manual to open based on LANGUAGE''' '''Choose the manual to open based on LANGUAGE'''
prefix = os.path.join(os.sep, 'usr', 'share', 'doc', 'terminator') prefix = os.path.join(os.sep, 'usr', 'share', 'doc', 'terminator')
languages = os.environ['LANGUAGE'].split(':') if 'LANGUAGE' in os.environ:
for language in languages: languages = os.environ['LANGUAGE'].split(':')
full_path = os.path.join(prefix, 'html_%s' % (language), 'index.html') for language in languages:
if os.path.isfile(full_path): full_path = os.path.join(prefix, 'html_%s' % (language), 'index.html')
dbg('Found %s manual' % (language)) if os.path.isfile(full_path):
return full_path dbg('Found %s manual' % (language))
dbg('Couldn\'t find manual for %s language' % (language)) return full_path
dbg('Couldn\'t find manual for %s language' % (language))
full_path = os.path.join(prefix, 'html', 'index.html') full_path = os.path.join(prefix, 'html', 'index.html')
if os.path.isfile(full_path): if os.path.isfile(full_path):