From a73e7edc8ecf8be5bed03bd1dea8e3a2ce47925c Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 20 Nov 2018 10:21:15 +0100 Subject: [PATCH] Add search in msgctxt --- rosetta/tests/django.po.test44.template | 3 ++- rosetta/tests/tests.py | 4 ++++ rosetta/views.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rosetta/tests/django.po.test44.template b/rosetta/tests/django.po.test44.template index c81bc6d..cda6ea2 100644 --- a/rosetta/tests/django.po.test44.template +++ b/rosetta/tests/django.po.test44.template @@ -2,7 +2,7 @@ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. -# +# msgid "" msgstr "" "Project-Id-Version: Rosetta\n" @@ -166,5 +166,6 @@ msgstr "" #. Translators: consectetur adipisicing #: templates/eiusmod/tempor.html:43 +msgctxt "purus pellentesque" msgid "Lorem ipsum" msgstr "dolor sit amet" diff --git a/rosetta/tests/tests.py b/rosetta/tests/tests.py index deede05..f7604ff 100644 --- a/rosetta/tests/tests.py +++ b/rosetta/tests/tests.py @@ -943,6 +943,10 @@ class RosettaTestCase(TestCase): r = self.client.get(url % 'adipisicing') self.assertContains(r, 'Lorem') + # Search context + r = self.client.get(url % 'pellentesque') + self.assertContains(r, 'Lorem') + def test_45_issue186_plural_msg_search(self): """Confirm that search of the .po file works for plurals. """ diff --git a/rosetta/views.py b/rosetta/views.py index 4d0593d..d7c75e6 100644 --- a/rosetta/views.py +++ b/rosetta/views.py @@ -601,6 +601,7 @@ class TranslationFormView(RosettaFileLevelMixin, TemplateView): def concat_entry(e): return (six.text_type(e.msgstr) + six.text_type(e.msgid) + + six.text_type(e.msgctxt) + six.text_type(e.comment) + u''.join([o[0] for o in e.occurrences]) + six.text_type(e.msgid_plural) +