[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - vocabularywidget.py:1.61

Zachery Bir zbir at urbanape.com
Wed Jan 28 14:45:46 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv10392

Modified Files:
	vocabularywidget.py 
Log Message:
use the translation service to perform the l10n translations


=== Zope3/src/zope/app/browser/form/vocabularywidget.py 1.60 => 1.61 ===
--- Zope3/src/zope/app/browser/form/vocabularywidget.py:1.60	Wed Oct 29 15:24:17 2003
+++ Zope3/src/zope/app/browser/form/vocabularywidget.py	Wed Jan 28 14:45:45 2004
@@ -22,13 +22,15 @@
 from xml.sax.saxutils import quoteattr
 
 from zope.interface import implements, implementedBy
+from zope.app import zapi
 from zope.app.browser.form import widget
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.interfaces.browser.form import IVocabularyQueryView
 from zope.app.interfaces.form import WidgetInputError
+from zope.app.services.servicenames import Translation
 from zope.interface.declarations import directlyProvides
 from zope.publisher.browser import BrowserView
-from zope.component import getView
+from zope.component import getView, getService
 from zope.security.proxy import trustedRemoveSecurityProxy
 from zope.schema.interfaces import IIterableVocabularyQuery
 from zope.schema.interfaces import ValidationError
@@ -117,8 +119,9 @@
 class TranslationHook:
 
     def translate(self, msgid):
-        # XXX This is where we should be calling on the translation service
-        return msgid.default
+        ts = zapi.getService(self.context, Translation)
+        msg = ts.translate(msgid, context=self.request)
+        return msg
 
 def message(msgid, default):
     msgid.default = default




More information about the Zope3-Checkins mailing list