[Zope3-checkins] CVS: Zope3/src/zope/tal - driver.py:1.6
dummyengine.py:1.15 talgenerator.py:1.14
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Mar 8 18:34:29 EST 2004
Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv4394/src/zope/tal
Modified Files:
driver.py dummyengine.py talgenerator.py
Log Message:
Use new translation API.
=== Zope3/src/zope/tal/driver.py 1.5 => 1.6 ===
--- Zope3/src/zope/tal/driver.py:1.5 Mon Jun 30 14:38:18 2003
+++ Zope3/src/zope/tal/driver.py Mon Mar 8 18:33:58 2004
@@ -47,12 +47,12 @@
# Import local classes
import zope.tal.taldefs
from zope.tal.dummyengine import DummyEngine
-from zope.tal.dummyengine import DummyTranslationService
+from zope.tal.dummyengine import DummyTranslationDomain
FILE = "tests/input/test01.xml"
-class TestTranslations(DummyTranslationService):
- def translate(self, msgid, domain=None, mapping=None, context=None,
+class TestTranslations(DummyTranslationDomain):
+ def translate(self, msgid, mapping=None, context=None,
target_language=None, default=None):
if msgid == 'timefmt':
return '%(minutes)s minutes after %(hours)s %(ampm)s' % mapping
@@ -65,15 +65,15 @@
return 'mailto:bperson at dom.ain'
elif msgid == 'origin':
return '%(name)s was born in %(country)s' % mapping
- return DummyTranslationService.translate(
- self, msgid, domain, mapping, context,
+ return DummyTranslationDomain.translate(
+ self, msgid, mapping, context,
target_language, default=default)
class TestEngine(DummyEngine):
def __init__(self, macros=None):
DummyEngine.__init__(self, macros)
- self.translationService = TestTranslations()
+ self.translationDomain = TestTranslations()
def evaluatePathOrVar(self, expr):
if expr == 'here/currentTime':
@@ -103,7 +103,6 @@
}
def usage(code, msg=''):
- # Python 2.1 required
print >> sys.stderr, __doc__
if msg:
print >> sys.stderr, msg
=== Zope3/src/zope/tal/dummyengine.py 1.14 => 1.15 ===
--- Zope3/src/zope/tal/dummyengine.py:1.14 Thu Aug 21 10:19:29 2003
+++ Zope3/src/zope/tal/dummyengine.py Mon Mar 8 18:33:58 2004
@@ -20,7 +20,7 @@
from zope.interface import implements
from zope.tal.taldefs import NAME_RE, TALExpressionError, ErrorInfo
from zope.tal.interfaces import ITALExpressionCompiler, ITALExpressionEngine
-from zope.i18n.interfaces import ITranslationService
+from zope.i18n.interfaces import ITranslationDomain
from zope.i18n.messageid import MessageID
Default = object()
@@ -44,7 +44,7 @@
dict = {'nothing': None, 'default': Default}
self.locals = self.globals = dict
self.stack = [dict]
- self.translationService = DummyTranslationService()
+ self.translationDomain = DummyTranslationDomain()
self.useEngineAttrDicts = False
def getCompilerError(self):
@@ -195,8 +195,9 @@
return Default
def translate(self, msgid, domain=None, mapping=None, default=None):
- return self.translationService.translate(
- msgid, domain, mapping, default=default)
+ self.translationDomain.domain = domain
+ return self.translationDomain.translate(
+ msgid, mapping, default=default)
def evaluateCode(self, lang, code):
# We probably implement too much, but I use the dummy engine to test
@@ -259,11 +260,15 @@
return 1
-class DummyTranslationService:
- implements(ITranslationService)
+class DummyTranslationDomain:
+ implements(ITranslationDomain)
- def translate(self, msgid, domain=None, mapping=None, context=None,
+ domain = ''
+
+ def translate(self, msgid, mapping=None, context=None,
target_language=None, default=None):
+
+ domain = self.domain
# This is a fake translation service which simply uppercases non
# ${name} placeholder text in the message id.
#
=== Zope3/src/zope/tal/talgenerator.py 1.13 => 1.14 ===
--- Zope3/src/zope/tal/talgenerator.py:1.13 Mon Nov 3 16:37:50 2003
+++ Zope3/src/zope/tal/talgenerator.py Mon Mar 8 18:33:58 2004
@@ -15,7 +15,6 @@
$Id$
"""
-
import cgi
import re
More information about the Zope3-Checkins
mailing list