Mercurial > genshi > mirror
comparison genshi/filters/tests/i18n.py @ 1018:fa0e84724fee stable-0.6.x
Merge r1242 from trunk (fix handling of case where a translation has text after a closing tag).
author | hodgestar |
---|---|
date | Thu, 09 Jan 2014 21:26:14 +0000 |
parents | ea40c6ff63da |
children |
comparison
equal
deleted
inserted
replaced
1015:203d981d314a | 1018:fa0e84724fee |
---|---|
903 translator.setup(tmpl) | 903 translator.setup(tmpl) |
904 self.assertEqual("""<html> | 904 self.assertEqual("""<html> |
905 <p>FIRST <span>SECOND</span> KEPT <span>Inside a tag</span> tail""" | 905 <p>FIRST <span>SECOND</span> KEPT <span>Inside a tag</span> tail""" |
906 """</p></html>""", | 906 """</p></html>""", |
907 tmpl.generate(first="FIRST", second="SECOND").render()) | 907 tmpl.generate(first="FIRST", second="SECOND").render()) |
908 | |
909 def test_translate_i18n_msg_ticket_404_regression(self): | |
910 tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" | |
911 xmlns:i18n="http://genshi.edgewall.org/i18n"> | |
912 <h1 i18n:msg="name">text <a>$name</a></h1> | |
913 </html>""") | |
914 gettext = lambda s: u'head [1:%(name)s] tail' | |
915 translator = Translator(gettext) | |
916 translator.setup(tmpl) | |
917 self.assertEqual("""<html> | |
918 <h1>head <a>NAME</a> tail</h1> | |
919 </html>""", tmpl.generate(name='NAME').render()) | |
908 | 920 |
909 | 921 |
910 class ChooseDirectiveTestCase(unittest.TestCase): | 922 class ChooseDirectiveTestCase(unittest.TestCase): |
911 | 923 |
912 def test_translate_i18n_choose_as_attribute(self): | 924 def test_translate_i18n_choose_as_attribute(self): |