comparison genshi/filters/tests/i18n.py @ 595:6d51c8df5d5a stable-0.4.x

Ported [708] to 0.4.x branch.
author cmlenz
date Mon, 13 Aug 2007 23:04:50 +0000
parents d8ccbef91504
children 2c52ec2c9d7e
comparison
equal deleted inserted replaced
591:a3c011711a30 595:6d51c8df5d5a
18 from genshi.template import MarkupTemplate 18 from genshi.template import MarkupTemplate
19 from genshi.filters.i18n import Translator, extract 19 from genshi.filters.i18n import Translator, extract
20 20
21 21
22 class TranslatorTestCase(unittest.TestCase): 22 class TranslatorTestCase(unittest.TestCase):
23
24 def test_extract_without_text(self):
25 tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/">
26 <p title="Bar">Foo</p>
27 ${ngettext("Singular", "Plural", num)}
28 </html>""")
29 translator = Translator(extract_text=False)
30 messages = list(translator.extract(tmpl.stream))
31 self.assertEqual(1, len(messages))
32 self.assertEqual((3, 'ngettext', (u'Singular', u'Plural')), messages[0])
23 33
24 def test_extract_plural_form(self): 34 def test_extract_plural_form(self):
25 tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> 35 tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/">
26 ${ngettext("Singular", "Plural", num)} 36 ${ngettext("Singular", "Plural", num)}
27 </html>""") 37 </html>""")
Copyright (C) 2012-2017 Edgewall Software