[Zope3-checkins] CVS: Zope3/src/zope/tal - dummyengine.py:1.5
Barry Warsaw
barry@wooz.org
Tue, 25 Mar 2003 18:25:18 -0500
Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv19100/src/zope/tal
Modified Files:
dummyengine.py
Log Message:
Refactored the translation service interfaces and updated all the
tests.
=== Zope3/src/zope/tal/dummyengine.py 1.4 => 1.5 ===
--- Zope3/src/zope/tal/dummyengine.py:1.4 Tue Mar 25 11:21:48 2003
+++ Zope3/src/zope/tal/dummyengine.py Tue Mar 25 18:25:16 2003
@@ -21,7 +21,6 @@
from zope.tal.taldefs import NAME_RE, TALESError, ErrorInfo
from zope.tal.interfaces import ITALESCompiler, ITALESEngine
from zope.i18n.interfaces import ITranslationService
-from zope.i18n.interfaces import IDomain
Default = object()
@@ -212,10 +211,11 @@
self.engine.setLocal(self.name, item)
return 1
-class DummyDomain:
- __implements__ = IDomain
- def translate(self, msgid, mapping=None, context=None,
+class DummyTranslationService:
+ __implements__ = ITranslationService
+
+ def translate(self, domain, msgid, mapping=None, context=None,
target_language=None):
# This is a fake translation service which simply uppercases non
# ${name} placeholder text in the message id.
@@ -232,15 +232,3 @@
return mapping[m.group(m.lastindex).lower()]
cre = re.compile(r'\$(?:([_A-Z]\w*)|\{([_A-Z]\w*)\})')
return cre.sub(repl, msgid.upper())
-
-class DummyTranslationService:
- __implements__ = ITranslationService
-
- def translate(self, domain, msgid, mapping=None, context=None,
- target_language=None):
- # Ignore domain
- return self.getDomain(domain).translate(msgid, mapping, context,
- target_language)
-
- def getDomain(self, domain):
- return DummyDomain()