[Zope3-checkins] CVS: Zope3/src/zope/tal - talgettext.py:1.16

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Aug 18 17:45:00 EDT 2003


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

Modified Files:
	talgettext.py 
Log Message:
Made extract.py work with message ids that have default values. Default 
values will be added as comments above the message string. Had to update
the ZCML and TAL stuff to make this feature useful.


=== Zope3/src/zope/tal/talgettext.py 1.15 => 1.16 ===
--- Zope3/src/zope/tal/talgettext.py:1.15	Tue Aug 12 15:12:48 2003
+++ Zope3/src/zope/tal/talgettext.py	Mon Aug 18 16:44:54 2003
@@ -36,10 +36,11 @@
 
 from zope.interface import implements
 from zope.tal.htmltalparser import HTMLTALParser
-from zope.tal.talinterpreter import TALInterpreter
+from zope.tal.talinterpreter import TALInterpreter, normalize
 from zope.tal.dummyengine import DummyEngine
 from zope.tal.interfaces import ITALExpressionEngine
 from zope.tal.taldefs import TALExpressionError
+from zope.i18n.messageid import MessageID
 
 __version__ = '$Revision$'
 
@@ -111,6 +112,12 @@
                   #     interface
                   position=None):
 
+        # Make the message is a MessageID object, if the default differs
+        # from the value, so that the POT generator can put the default
+        # text into a comment.
+        if default is not None and normalize(default) != msgid:
+            msgid = MessageID(msgid, default=default)
+        
         if domain not in self.catalog:
             self.catalog[domain] = {}
         domain = self.catalog[domain]




More information about the Zope3-Checkins mailing list