From 9474ae6aa78d4ee99911896f80a9de230e636744 Mon Sep 17 00:00:00 2001 From: Hugo MOCHET Date: Tue, 6 Jun 2017 12:25:38 +0200 Subject: [PATCH] Display the sentence when translation not found --- tcii18n/translator.py | 1 + test/i18n.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tcii18n/translator.py b/tcii18n/translator.py index d6ff9e9..5a3f4ee 100644 --- a/tcii18n/translator.py +++ b/tcii18n/translator.py @@ -13,3 +13,4 @@ def translate(self, sentence, **kwargs): for key, value in kwargs.items(): row[1] = row[1] % {key: value} return row[1] + return sentence diff --git a/test/i18n.py b/test/i18n.py index 3c0697d..877b03d 100644 --- a/test/i18n.py +++ b/test/i18n.py @@ -21,3 +21,6 @@ def test_switch_language(self): self.assertEqual(self.trans_it('TCI title'), 'ITC titolo') self.assertEqual(self.trans_it('Welcome %(user)s!', user='John'), 'Benvenuto John!') + + def test_display_unknown_message(self): + self.assertEqual(self.trans('Unknown message'), 'Unknown message')