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

Fred L. Drake, Jr. fred@zope.com
Thu, 3 Apr 2003 16:26:18 -0500


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

Modified Files:
	talgettext.py 
Log Message:
- pass default text to the translation service
- when skipping a file because of an error, still print the traceback


=== Zope3/src/zope/tal/talgettext.py 1.6 => 1.7 ===
--- Zope3/src/zope/tal/talgettext.py:1.6	Thu Apr  3 11:18:38 2003
+++ Zope3/src/zope/tal/talgettext.py	Thu Apr  3 16:26:17 2003
@@ -33,6 +33,7 @@
 import os
 import sys
 import string
+import traceback
 
 from zope.tal.htmltalparser import HTMLTALParser
 from zope.tal.talinterpreter import TALInterpreter
@@ -50,7 +51,7 @@
 
 
 class POTALInterpreter(TALInterpreter):
-    def translate(self, msgid, i18ndict=None, obj=None):
+    def translate(self, msgid, default, i18ndict=None, obj=None):
         # XXX is this right?
         if i18ndict is None:
             i18ndict = {}
@@ -62,7 +63,7 @@
             return None
         # XXX We need to pass in one of context or target_language
         return self.engine.translate(self.i18nContext.domain, msgid, i18ndict,
-                                     position=self.position)
+                                     position=self.position, default=default)
 
 
 class POEngine(DummyEngine):
@@ -85,7 +86,7 @@
     def evaluateBoolean(self, expr):
         return 1 # dummy
 
-    def translate(self, domain, msgid, mapping, position):
+    def translate(self, domain, msgid, default, mapping, position):
         # assume domain and mapping are ignored; if they are not,
         # unit test must be updated.
         if msgid not in self.catalog:
@@ -240,7 +241,7 @@
                              metal=0)()
         except: # Hee hee, I love bare excepts!
             print 'There was an error processing', filename
-            print sys.exc_info()[1]
+            traceback.print_exc()
 
     # Now output the keys in the engine
     # write them to a file if --output is specified; otherwise use standard out