[ZPT] CVS: Zope3/lib/python/Zope/TAL/tests - test_htmltalparser.py:1.25.14.2.6.6

Barry Warsaw barry@wooz.org
Wed, 5 Jun 2002 15:26:10 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/TAL/tests
In directory cvs.zope.org:/tmp/cvs-serv18000/lib/python/Zope/TAL/tests

Modified Files:
      Tag: fdrake-tal-i18n-branch
	test_htmltalparser.py 
Log Message:
added tests of the intermediate code for the i18n:translate examples
(taken from test19.html and test20.html)


=== Zope3/lib/python/Zope/TAL/tests/test_htmltalparser.py 1.25.14.2.6.5 => 1.25.14.2.6.6 ===
             ])
 
+    def check_i18n_translate(self):
+        self._run_check('''\
+<span i18n:translate="">Replace this</span>
+<span i18n:translate="msgid">This is a
+translated string</span>
+<span i18n:translate="">And another
+translated string</span>
+''', [
+  ('setPosition', (1, 0)),
+  ('beginScope', {'i18n:translate': ''}),
+  ('startTag', ('span', [('i18n:translate', '', 'i18n')])),
+  ('insertTranslation', ('', [('rawtextOffset', ('Replace this', 12))])),
+  ('rawtextBeginScope',
+   ('</span>\n', 0, (2, 0), 1, {'i18n:translate': 'msgid'})),
+  ('startTag', ('span', [('i18n:translate', 'msgid', 'i18n')])),
+  ('insertTranslation',
+   ('msgid', [('rawtextColumn', ('This is a\ntranslated string', 17))])),
+  ('rawtextBeginScope', ('</span>\n', 0, (4, 0), 1, {'i18n:translate': ''})),
+  ('startTag', ('span', [('i18n:translate', '', 'i18n')])),
+  ('insertTranslation',
+   ('', [('rawtextColumn', ('And another\ntranslated string', 17))])),
+  ('endScope', ()),
+  ('rawtextColumn', ('</span>\n', 0))])
+
+    def check_i18n_translate_with_nested_tal(self):
+        self._run_check('''\
+<span i18n:translate="">replaceable <p tal:replace="str:here">content</p></span>
+''', [
+  ('setPosition', (1, 0)),
+  ('beginScope', {'i18n:translate': ''}),
+  ('startTag', ('span', [('i18n:translate', '', 'i18n')])),
+  ('insertTranslation',
+   ('',
+    [('rawtextOffset', ('replaceable ', 12)),
+     ('setPosition', (1, 36)),
+     ('beginScope', {'tal:replace': 'str:here'}),
+     ('insertText',
+      ('$str:here$',
+       [('startTag', ('p', [('tal:replace', 'str:here', 'tal')])),
+        ('rawtextOffset', ('content</p>', 11))])),
+     ('endScope', ())])),
+  ('endScope', ()),
+  ('rawtextColumn', ('</span>\n', 0))
+  ])
+
 
 def test_suite():
     suite = unittest.TestSuite()