[Zope-Checkins] CVS: Zope3/lib/python/Zope/TAL - DummyEngine.py:1.34 TALInterpreter.py:1.71

Stephan Richter srichter@cbu.edu
Wed, 12 Jun 2002 20:03:58 -0400


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

Modified Files:
	DummyEngine.py TALInterpreter.py 
Log Message:
YEAH! The first translations work. If you switch your user language to 'de'
you can see  two German phrases in the management screen of a Translation
Service.

I also made somce changes in the TALInterpretor, but I dunno whether my 
changes were correct...lack of sleep... Fred and Barry, could you double 
check?


=== Zope3/lib/python/Zope/TAL/DummyEngine.py 1.33 => 1.34 ===
         return Default
 
-    def getTranslationService(self):
-        return self.translationService
+    def translate(self, domain, msgid, mapping):
+        return self.translationService.translate(domain, msgid, mapping)
+    
 
 class Iterator:
 


=== Zope3/lib/python/Zope/TAL/TALInterpreter.py 1.70 => 1.71 ===
         # s is the value of an attribute before translation
         # it may have been computed
-        raise NotImplementedError("cannot translate %r" % s)
+        return self.translate(s, {})
+
 
     bytecode_handlers["<attrAction>"] = attrAction
 
@@ -444,7 +445,7 @@
                                               target=get("target"))
     bytecode_handlers["beginI18nContext"] = do_beginI18nContext
 
-    def do_endI18nContext(self):
+    def do_endI18nContext(self, notused=None):
         self.i18nContext = self.i18nContext.parent
         assert self.i18nContext is not None
     bytecode_handlers["endI18nContext"] = do_endI18nContext
@@ -590,9 +591,9 @@
         # algorithm in Mailman.
         if not self.i18nInterpolate:
             return msgid
-        service = self.engine.getTranslationService()
+        # service = self.engine.getTranslationService()
         # We need to pass in one of context or target_language
-        return service.translate(self.i18nContext.domain, msgid, i18ndict)
+        return self.engine.translate(self.i18nContext.domain, msgid, i18ndict)
 
     def do_rawtextColumn(self, (s, col)):
         self._stream_write(s)