[ZPT] CVS: Zope3/lib/python/Zope/TAL/tests - test_htmltalparser.py:1.25.14.2.6.8
Barry Warsaw
barry@wooz.org
Mon, 10 Jun 2002 15:57:30 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/TAL/tests
In directory cvs.zope.org:/tmp/cvs-serv13643/lib/python/Zope/TAL/tests
Modified Files:
Tag: fdrake-tal-i18n-branch
test_htmltalparser.py
Log Message:
Added some tests for i18n:name support, both with and without
tal:replace attributes in the same tag.
=== Zope3/lib/python/Zope/TAL/tests/test_htmltalparser.py 1.25.14.2.6.7 => 1.25.14.2.6.8 ===
])
+ def check_i18n_name(self):
+ self._run_check('''\
+<span i18n:translate="">
+ <span tal:replace="str:Lomax" i18n:name="name" /> was born in
+ <span tal:replace="str:Antarctica" i18n:name="country" />.
+</span>
+''', [
+ ('setPosition', (1, 0)),
+ ('beginScope', {'i18n:translate': ''}),
+ ('startTag', ('span', [('i18n:translate', '', 'i18n')])),
+ ('insertTranslation',
+ ('',
+ [('rawtextBeginScope',
+ ('\n ',
+ 2,
+ (2, 2),
+ 0,
+ {'i18n:name': 'name', 'tal:replace': 'str:Lomax'})),
+ ('i18nVariable',
+ ('name',
+ '$str:Lomax$',
+ [('startEndTag',
+ ('span',
+ [('tal:replace', 'str:Lomax', 'tal'),
+ ('i18n:name', 'name', 'i18n')]))])),
+ ('rawtextBeginScope',
+ (' was born in\n ',
+ 2,
+ (3, 2),
+ 1,
+ {'i18n:name': 'country', 'tal:replace': 'str:Antarctica'})),
+ ('i18nVariable',
+ ('country',
+ '$str:Antarctica$',
+ [('startEndTag',
+ ('span',
+ [('tal:replace', 'str:Antarctica', 'tal'),
+ ('i18n:name', 'country', 'i18n')]))])),
+ ('endScope', ()),
+ ('rawtextColumn', ('.\n', 0))])),
+ ('endScope', ()),
+ ('rawtextColumn', ('</span>\n', 0))
+ ])
+
+ def check_i18n_name_implicit_value(self):
+ self._run_check('''\
+<span i18n:translate="">
+ <span i18n:name="name"><b>Jim</b></span> was born in
+ <span i18n:name="country">the USA</span>.
+</span>
+''', [
+ ('setPosition', (1, 0)),
+ ('beginScope', {'i18n:translate': ''}),
+ ('startTag', ('span', [('i18n:translate', '', 'i18n')])),
+ ('insertTranslation',
+ ('',
+ [('rawtextBeginScope', ('\n ', 2, (2, 2), 0, {'i18n:name': 'name'})),
+ ('i18nVariable',
+ ('name',
+ [('rawtextOffset', ('<b>Jim</b>', 10))],
+ [('startTag', ('span', [('i18n:name', 'name', 'i18n')])),
+ ('rawtextOffset', ('<b>Jim</b></span>', 17))])),
+ ('rawtextBeginScope',
+ (' was born in\n ', 2, (3, 2), 1, {'i18n:name': 'country'})),
+ ('i18nVariable',
+ ('country',
+ [('rawtextOffset', ('the USA', 7))],
+ [('startTag', ('span', [('i18n:name', 'country', 'i18n')])),
+ ('rawtextOffset', ('the USA</span>', 14))])),
+ ('endScope', ()),
+ ('rawtextColumn', ('.\n', 0))])),
+ ('endScope', ()),
+ ('rawtextColumn', ('</span>\n', 0))
+ ])
+
def check_i18n_context_domain(self):
self._run_check("<span i18n:domain='mydomain'/>", [
('setPosition', (1, 0)),