[Zope3-checkins] SVN: Zope3/branches/3.3/src/zope/ The default
Context implementation wasn't fully complying with
ITALExpressionEngine,
Philipp von Weitershausen
philikon at philikon.de
Sun May 21 07:23:42 EDT 2006
Log message for revision 68201:
The default Context implementation wasn't fully complying with ITALExpressionEngine,
it was missing the 'translate()' method. THus, when using it without any customizations
(zope.app and Zope2 do customize the Context, so it's not a problem there), you'd
get an error. A test in zope.pagetemplate exercises this now.
Changed:
A Zope3/branches/3.3/src/zope/pagetemplate/tests/input/translation.html
A Zope3/branches/3.3/src/zope/pagetemplate/tests/output/translation.html
U Zope3/branches/3.3/src/zope/pagetemplate/tests/test_htmltests.py
U Zope3/branches/3.3/src/zope/tales/tales.py
-=-
Added: Zope3/branches/3.3/src/zope/pagetemplate/tests/input/translation.html
===================================================================
--- Zope3/branches/3.3/src/zope/pagetemplate/tests/input/translation.html 2006-05-20 13:42:31 UTC (rev 68200)
+++ Zope3/branches/3.3/src/zope/pagetemplate/tests/input/translation.html 2006-05-21 11:23:41 UTC (rev 68201)
@@ -0,0 +1,2 @@
+<p i18n:translate="">Define and translate message id in ZPT</p>
+<p tal:content="options/msg">Insert Message object here</p>
Property changes on: Zope3/branches/3.3/src/zope/pagetemplate/tests/input/translation.html
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Zope3/branches/3.3/src/zope/pagetemplate/tests/output/translation.html
===================================================================
--- Zope3/branches/3.3/src/zope/pagetemplate/tests/output/translation.html 2006-05-20 13:42:31 UTC (rev 68200)
+++ Zope3/branches/3.3/src/zope/pagetemplate/tests/output/translation.html 2006-05-21 11:23:41 UTC (rev 68201)
@@ -0,0 +1,2 @@
+<p>Define and translate message id in ZPT</p>
+<p>Translate this!</p>
Property changes on: Zope3/branches/3.3/src/zope/pagetemplate/tests/output/translation.html
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Zope3/branches/3.3/src/zope/pagetemplate/tests/test_htmltests.py
===================================================================
--- Zope3/branches/3.3/src/zope/pagetemplate/tests/test_htmltests.py 2006-05-20 13:42:31 UTC (rev 68200)
+++ Zope3/branches/3.3/src/zope/pagetemplate/tests/test_htmltests.py 2006-05-21 11:23:41 UTC (rev 68201)
@@ -124,7 +124,17 @@
out = t()
util.check_html(expect, out)
+ def test_translation(self):
+ from zope.i18nmessageid import MessageFactory
+ _ = MessageFactory('pttest')
+ msg = _("Translate this!")
+ t = self.folder.t
+ t.write(util.read_input('translation.html'))
+ expect = util.read_output('translation.html')
+ out = t(msg=msg)
+ util.check_html(expect, out)
+
def test_suite():
return unittest.makeSuite(HTMLTests)
Modified: Zope3/branches/3.3/src/zope/tales/tales.py
===================================================================
--- Zope3/branches/3.3/src/zope/tales/tales.py 2006-05-20 13:42:31 UTC (rev 68200)
+++ Zope3/branches/3.3/src/zope/tales/tales.py 2006-05-21 11:23:41 UTC (rev 68201)
@@ -730,7 +730,12 @@
def setPosition(self, position):
self.position = position
+ def translate(self, msgid, domain=None, mapping=None, default=None):
+ # custom Context implementations are supposed to customize
+ # this to call whichever translation routine they want to use
+ return unicode(msgid)
+
class TALESTracebackSupplement(object):
"""Implementation of zope.exceptions.ITracebackSupplement"""
More information about the Zope3-Checkins
mailing list