From fb59760d5169818774d51dc0a6a8e66e5cd2331f Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 5 Jan 2019 13:35:02 +0100 Subject: Fixes #4 --- ausbutler/tour_config.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ausbutler/tour_config.py') diff --git a/ausbutler/tour_config.py b/ausbutler/tour_config.py index 755bac9..8969d00 100644 --- a/ausbutler/tour_config.py +++ b/ausbutler/tour_config.py @@ -13,15 +13,24 @@ class Translations(object): } translation_mapping = load_config('logoh') custom_translations = load_config('translations') + warned_missing_keys = [] @staticmethod def get_translation(key): + missing_logoh_key = False if key in Translations.translation_mapping: - return Translations.translation_cache[ - Translations.translation_mapping[key]] + if Translations.translation_mapping[key] not in Translations.translation_cache: + missing_logoh_key = True + else: + return Translations.translation_cache[ + Translations.translation_mapping[key]] if key in Translations.custom_translations: return Translations.custom_translations[key][ Translations.detect_language()] + elif missing_logoh_key: + if key not in Translations.warned_missing_keys: + print 'WARNING: translation key "%s" not found in logoh table!' % (key) + Translations.warned_missing_keys.append(key) return '{{%s}}' % (key) @staticmethod -- cgit v1.2.3