Mercurial > genshi > mirror
diff genshi/filters/tests/i18n.py @ 549:7214c1bdb383 trunk
The I18n filter now extracts text from translation functions in ignored tags. Fixes #132.
author | cmlenz |
---|---|
date | Mon, 02 Jul 2007 09:05:45 +0000 |
parents | 35a413f3f1dd |
children | 7e83be231f96 837786a584d5 66fd7f370acb |
line wrap: on
line diff
--- a/genshi/filters/tests/i18n.py +++ b/genshi/filters/tests/i18n.py @@ -132,6 +132,30 @@ (7, None, u'All the best,\n Foobar', []) ], results) + def test_extraction_inside_ignored_tags(self): + buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/"> + <script type="text/javascript"> + $('#llist').tabs({ + remote: true, + spinner: "${_('Please wait...')}" + }); + </script> + </html>""") + results = list(extract(buf, ['_'], [], {})) + self.assertEqual([ + (5, '_', u'Please wait...', []), + ], results) + + def test_extraction_inside_ignored_tags_with_directives(self): + buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/"> + <script type="text/javascript"> + <py:if test="foobar"> + alert("This shouldn't be extracted"); + </py:if> + </script> + </html>""") + self.assertEqual([], list(extract(buf, ['_'], [], {}))) + def suite(): suite = unittest.TestSuite()