comparison genshi/filters/tests/i18n.py @ 596:f436c7db99f5

Follow-up to [708]. The added `extract_text` option wasn't actually being handled by the Babel extraction plugin.
author cmlenz
date Tue, 14 Aug 2007 08:55:43 +0000
parents 0fb43dc2e165
children 0d802a7e3630
comparison
equal deleted inserted replaced
594:0fb43dc2e165 596:f436c7db99f5
277 (7, '_', u'Hello, %(name)s', []), 277 (7, '_', u'Hello, %(name)s', []),
278 (8, 'ngettext', (u'You have %d item', u'You have %d items', None), 278 (8, 'ngettext', (u'You have %d item', u'You have %d items', None),
279 []), 279 []),
280 ], results) 280 ], results)
281 281
282 def test_extraction_without_text(self):
283 buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/">
284 <p title="Bar">Foo</p>
285 ${ngettext("Singular", "Plural", num)}
286 </html>""")
287 results = list(extract(buf, ['_', 'ngettext'], [], {
288 'extract_text': 'no'
289 }))
290 self.assertEqual([
291 (3, 'ngettext', (u'Singular', u'Plural', None), []),
292 ], results)
293
282 def test_text_template_extraction(self): 294 def test_text_template_extraction(self):
283 buf = StringIO("""${_("Dear %(name)s") % {'name': name}}, 295 buf = StringIO("""${_("Dear %(name)s") % {'name': name}},
284 296
285 ${ngettext("Your item:", "Your items", len(items))} 297 ${ngettext("Your item:", "Your items", len(items))}
286 #for item in items 298 #for item in items
Copyright (C) 2012-2017 Edgewall Software