Skip to content
Browse files
Don't crash when translating untranslated strings
  • Loading branch information
ralsina committed May 14, 2017
1 parent 3270735 commit 0ec1216a2741ed7237e86d477d2c0acf7bce16bd
Showing 2 changed files with 6 additions and 0 deletions.
@@ -10,6 +10,8 @@ Features

* Don't crash when translating untranslated messages.

New in v7.8.5

@@ -265,6 +265,10 @@ def __call__(self, key, lang=None):
"""When called as a function, take an optional lang and return self[lang][key]."""
if lang is None:
lang = LocaleBorg().current_lang
if lang not in self:
LOGGER.warning('Unknown language %s', lang)
elif key not in self[lang]:
LOGGER.warning('Unknown message %s', key)
return self[lang][key]

0 comments on commit 0ec1216

Please sign in to comment.