[Zope3-checkins] CVS: Zope3/src/zope/tal - talinterpreter.py:1.18

Barry Warsaw barry@zope.com
Tue, 15 Apr 2003 17:31:52 -0400


Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv28347/src/zope/tal

Modified Files:
	talinterpreter.py 
Log Message:
do_insertText_tal(): When the engine evaluates some text and returns
us a MessageID, translate and interpolate it before escaping and using
it.


=== Zope3/src/zope/tal/talinterpreter.py 1.17 => 1.18 ===
--- Zope3/src/zope/tal/talinterpreter.py:1.17	Tue Apr  8 13:15:48 2003
+++ Zope3/src/zope/tal/talinterpreter.py	Tue Apr 15 17:31:52 2003
@@ -23,6 +23,7 @@
 # Do not use cStringIO here!  It's not unicode aware. :(
 from StringIO import StringIO
 
+from zope.i18n.messageid import MessageID
 from zope.tal.taldefs import quote, TAL_VERSION, TALError, METALError
 from zope.tal.taldefs import isCurrentVersion
 from zope.tal.taldefs import getProgramVersion, getProgramMode
@@ -471,6 +472,11 @@
         if text is self.Default:
             self.interpret(stuff[1])
             return
+        if isinstance(text, MessageID):
+            # Translate this now.  XXX passing None for the domain is bogus
+            # but necessary based on the signature of .translate().  We should
+            # switch msgid and domain, since domains tag along in MessageIDs.
+            text = self.engine.translate(None, text)
         # '&' must be done first!
         s = text.replace(
             "&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")