comparison genshi/filters/tests/i18n.py @ 1017:9c4fafa85f4a stable-0.7.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:25:21 +0000
parents 7f8b4df4f862
children
comparison
equal deleted inserted replaced
1014:2069c7a0059c 1017:9c4fafa85f4a
925 translator.setup(tmpl) 925 translator.setup(tmpl)
926 self.assertEqual("""<html> 926 self.assertEqual("""<html>
927 <p>FIRST <span>SECOND</span> KEPT <span>Inside a tag</span> tail""" 927 <p>FIRST <span>SECOND</span> KEPT <span>Inside a tag</span> tail"""
928 """</p></html>""", 928 """</p></html>""",
929 tmpl.generate(first="FIRST", second="SECOND").render()) 929 tmpl.generate(first="FIRST", second="SECOND").render())
930
931 def test_translate_i18n_msg_ticket_404_regression(self):
932 tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"
933 xmlns:i18n="http://genshi.edgewall.org/i18n">
934 <h1 i18n:msg="name">text <a>$name</a></h1>
935 </html>""")
936 gettext = lambda s: u'head [1:%(name)s] tail'
937 translator = Translator(gettext)
938 translator.setup(tmpl)
939 self.assertEqual("""<html>
940 <h1>head <a>NAME</a> tail</h1>
941 </html>""", tmpl.generate(name='NAME').render())
930 942
931 943
932 class ChooseDirectiveTestCase(unittest.TestCase): 944 class ChooseDirectiveTestCase(unittest.TestCase):
933 945
934 def test_translate_i18n_choose_as_attribute(self): 946 def test_translate_i18n_choose_as_attribute(self):
Copyright (C) 2012-2017 Edgewall Software