[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - widget.py:1.23

Jim Fulton jim@zope.com
Tue, 25 Mar 2003 15:40:16 -0500


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

Modified Files:
	widget.py 
Log Message:
Modified browser widgets to translate labels, which come from field titles


=== Zope3/src/zope/app/browser/form/widget.py 1.22 => 1.23 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.22	Thu Mar 20 10:05:44 2003
+++ Zope3/src/zope/app/browser/form/widget.py	Tue Mar 25 15:39:45 2003
@@ -27,6 +27,7 @@
 from zope.app.interfaces.form import ConversionError, WidgetInputError
 from zope.app.interfaces.form import MissingInputError
 from zope.schema.interfaces import ValidationError
+from zope.component import getService
 
 
 class BrowserWidget(Widget, BrowserView):
@@ -120,9 +121,11 @@
         return self.hidden()
 
     def label(self):
+        ts = getService(self.context.context, "Translation")
+        title = ts.translate("zope", self.title, context=self.request)
         return '<label for="%s">%s</label>' % (
             self.name,
-            self.title,
+            title,
             )
 
     def row(self):