diff options
author | Stephan Richter <stephan.richter@gmail.com> | 2004-03-08 23:33:59 +0000 |
---|---|---|
committer | Stephan Richter <stephan.richter@gmail.com> | 2004-03-08 23:33:59 +0000 |
commit | c760af359b874fd7e6522d82a2abd67d3dae1968 (patch) | |
tree | cba42be88ed1ab9f8972de2d98ec7e5ec9577c9d /dummyengine.py | |
parent | 1887ff0d7980d5ec6cb60a8c0e5c9926457d179f (diff) | |
download | zope-tal-c760af359b874fd7e6522d82a2abd67d3dae1968.tar.gz |
Use new translation API.
Diffstat (limited to 'dummyengine.py')
-rw-r--r-- | dummyengine.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/dummyengine.py b/dummyengine.py index 0e6f516..6927a74 100644 --- a/dummyengine.py +++ b/dummyengine.py @@ -13,14 +13,14 @@ ############################################################################## """Dummy TAL expression engine so that I can test out the TAL implementation. -$Id: dummyengine.py,v 1.14 2003/08/21 14:19:29 srichter Exp $ +$Id: dummyengine.py,v 1.15 2004/03/08 23:33:58 srichter Exp $ """ import re 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 @@ class DummyEngine: 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 @@ class DummyEngine: 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 @@ class Iterator: 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. # |