[Zope-Checkins]
SVN: Zope/branches/ajung-final-zpt-integration/lib/python/Products/PageTemplates/Engine.py
some cleanup
Andreas Jung
andreas at andreas-jung.com
Thu Mar 2 11:16:07 EST 2006
Log message for revision 65734:
some cleanup
Changed:
U Zope/branches/ajung-final-zpt-integration/lib/python/Products/PageTemplates/Engine.py
-=-
Modified: Zope/branches/ajung-final-zpt-integration/lib/python/Products/PageTemplates/Engine.py
===================================================================
--- Zope/branches/ajung-final-zpt-integration/lib/python/Products/PageTemplates/Engine.py 2006-03-02 16:03:42 UTC (rev 65733)
+++ Zope/branches/ajung-final-zpt-integration/lib/python/Products/PageTemplates/Engine.py 2006-03-02 16:16:06 UTC (rev 65734)
@@ -1,14 +1,18 @@
# Common Engine for Zope3-ZPT-in-Zope-2
+from GlobalTranslationService import getGlobalTranslationService
from zope.tales.tales import ExpressionEngine
from zope.tales.expressions import PathExpr, StringExpr, NotExpr, DeferExpr, SubPathExpr
from zope.tales.expressions import SimpleModuleImporter, _marker
from zope.tales.pythonexpr import PythonExpr
-from zope.tales.tales import _valid_name, _parse_expr, NAME_RE, Undefined
+from zope.tales.tales import _valid_name, _parse_expr, NAME_RE, Undefined, Context
+from zope.i18n import translate
+GTS = getGlobalTranslationService()
+
def BoboTraverseAwareSimpleTraverse(object, path_items, econtext):
""" a slightly modified version of zope.tales.expressions.simpleTraverse()
that interacts correctly with objects implementing bobo_traverse().
@@ -51,21 +55,24 @@
break
add(SubPathExpr(path, traverser, engine)._eval)
-
-from zope.tales.tales import Context
-
-
-from zope.i18n import translate
-
class Context(Context):
def translate(self, msgid, domain=None, mapping=None, default=None):
- # fix that
- return msgid
-# return translate(msgid, domain, mapping,
-# context=context, default=default)
+# import pdb
+# pdb.set_trace()
+ return GTS.translate(msgid, domain, mapping,
+ context=self.contexts['context'], default=default)
+ def translate(self, domain, msgid, mapping=None,
+ context=None, target_language=None, default=None):
+ if context is None:
+ context = self.contexts.get('here')
+ return getGlobalTranslationService().translate(
+ domain, msgid, mapping=mapping,
+ context=context,
+ default=default,
+ target_language=target_language)
class ExpressionEngine(ExpressionEngine):
More information about the Zope-Checkins
mailing list