[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form -
widget.py:1.47
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Aug 7 21:15:02 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv25289/browser/form
Modified Files:
widget.py
Log Message:
I18ned some more. Wow, the RegistrationWidget was tricky, but I fixed it.
I made the RegistrationWidget inherit from RadioWidget, which should have
been done this way in the first place.
I also noticed that there are still occurences where the interface field
attributes are not message-id'ed.
=== Zope3/src/zope/app/browser/form/widget.py 1.46 => 1.47 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.46 Thu Aug 7 13:40:28 2003
+++ Zope3/src/zope/app/browser/form/widget.py Thu Aug 7 20:14:28 2003
@@ -33,6 +33,7 @@
from zope.app.interfaces.form import MissingInputError
from zope.app.datetimeutils import parseDatetimetz
from zope.app.datetimeutils import DateTimeError
+from zope.app.services.servicenames import Translation
from zope.schema import getFieldNamesInOrder
from zope.schema.interfaces import ValidationError
from zope.schema.errornames import RequiredMissing
@@ -216,7 +217,7 @@
return txt
def label(self):
- ts = getService(self.context, "Translation")
+ ts = getService(self.context, Translation)
# Note that the domain is not that important here, since the title
# is most likely a message id carrying the domain anyways.
title = ts.translate(self.title, "zope", context=self.request)
@@ -753,13 +754,19 @@
'''Returns the text for the given value.
Override this in subclasses.'''
+ # The text could be a MessageID, in which case we should try to
+ # translate it.
+ ts = getService(self.context.context, Translation)
+ trans = ts.translate(value, "zope", context=self.request)
+ if trans is not None:
+ value = trans
return value
def renderItems(self, value):
name = self.name
# get items
- items = self.context.allowed_values
-
+ items = self.context.allowed_values
+
# check if we want to select first item
if (not value and getattr(self.context, 'firstItem', False)
and len(items) > 0):
@@ -859,7 +866,7 @@
return self._renderItem(index, text, value, name, cssClass, True)
def label(self):
- ts = getService(self.context.context, "Translation")
+ ts = getService(self.context.context, Translation)
title = ts.translate(self.title, "zope", context=self.request)
if title is None:
title = self.title
More information about the Zope3-Checkins
mailing list