From 5fe91b66b1ccf851e712c68062873f14c14e1187 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 8 Aug 2015 05:21:59 +0200 Subject: [PATCH] Small fix for systems (i.e. my 12.04 LTS) that don't set LANGUAGE for whatever reason. This breaks the manual lookup --- terminatorlib/util.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/terminatorlib/util.py b/terminatorlib/util.py index f9838811..aa19ff8b 100755 --- a/terminatorlib/util.py +++ b/terminatorlib/util.py @@ -87,13 +87,14 @@ def has_ancestor(widget, wtype): def manual_lookup(): '''Choose the manual to open based on LANGUAGE''' prefix = os.path.join(os.sep, 'usr', 'share', 'doc', 'terminator') - languages = os.environ['LANGUAGE'].split(':') - for language in languages: - full_path = os.path.join(prefix, 'html_%s' % (language), 'index.html') - if os.path.isfile(full_path): - dbg('Found %s manual' % (language)) - return full_path - dbg('Couldn\'t find manual for %s language' % (language)) + if 'LANGUAGE' in os.environ: + languages = os.environ['LANGUAGE'].split(':') + for language in languages: + full_path = os.path.join(prefix, 'html_%s' % (language), 'index.html') + if os.path.isfile(full_path): + dbg('Found %s manual' % (language)) + return full_path + dbg('Couldn\'t find manual for %s language' % (language)) full_path = os.path.join(prefix, 'html', 'index.html') if os.path.isfile(full_path):