Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't crash when translating untranslated strings
  • Loading branch information
ralsina committed May 14, 2017
1 parent 3270735 commit 0ec1216
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -10,6 +10,8 @@ Features
Bugfixes
--------

* Don't crash when translating untranslated messages.

New in v7.8.5
=============

Expand Down
4 changes: 4 additions & 0 deletions nikola/utils.py
Expand Up @@ -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]


Expand Down

0 comments on commit 0ec1216

Please sign in to comment.