diff genshi/filters/tests/i18n.py @ 594:0fb43dc2e165

Add option to I18n filter to only extract strings in gettext function calls.
author cmlenz
date Mon, 13 Aug 2007 23:02:46 +0000
parents aa8e85a4085e
children f436c7db99f5
line wrap: on
line diff
--- a/genshi/filters/tests/i18n.py
+++ b/genshi/filters/tests/i18n.py
@@ -21,6 +21,17 @@
 
 class TranslatorTestCase(unittest.TestCase):
 
+    def test_extract_without_text(self):
+        tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/">
+          <p title="Bar">Foo</p>
+          ${ngettext("Singular", "Plural", num)}
+        </html>""")
+        translator = Translator(extract_text=False)
+        messages = list(translator.extract(tmpl.stream))
+        self.assertEqual(1, len(messages))
+        self.assertEqual((3, 'ngettext', (u'Singular', u'Plural', None)),
+                         messages[0])
+
     def test_extract_plural_form(self):
         tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/">
           ${ngettext("Singular", "Plural", num)}
Copyright (C) 2012-2017 Edgewall Software