[Grok-dev] i18n translation weirdness
nnieto at noenieto.com
Mon Apr 30 17:26:58 UTC 2012
Indeed, that's what's happening.
I used zope.i18n.translate to force the translation in spanish:
self.widgets['city'].title = translate(_(u'City?'),
It's not pretty, but it works.
2012/4/30 Jan-Wijbrand Kolman <janwijbrand at gmail.com>
> On 27/04/2012 19:23 , Noe Nieto wrote:
>> We have a couple of grok.Forms where we change the title of some widgets
>> in the setUpWidgets() callback:
>> def setUpWidgets(self, ignore_request=False):
>> super(AddProjectForm, self).setUpWidgets(ignore_**request)
>> self.widgets['city'].label = '1'
>> self.widgets['specialty'].**label = '2'
>> self.widgets['contractor'].**label = '2'
>> self.widgets['city'].title = _(u'City?')
>> self.widgets['specialty'].**title = _(u'What you need to do?')
>> self.widgets['contractor'].**title = _(u'Who you want for you
>> The problem with this is that, while our translatable strings are
>> recognized as translations and we have proper translation strings in our
>> .po files, these strings are never translated.
>> So, what's the catch?
> I think when the titles are being interpolated into the page template they
> are no longer recognized as message ids.
> I'm slightly guessing here but either you add i18n:translate="" attributes
> in the tal elements that interpolate the titles in the form rendering
> template or call translate (for example from zope.i18n.translate) on the
> message ids in setUpWidgets.
> regards, jw
> Grok-dev mailing list
> Grok-dev at zope.org
NNieto Consulting Services
M: nnieto at noenieto.com
T: @tzicatl <https://twitter.com/#%21/tzicatl>
Li: Perfil en LinkedIn <http://www.linkedin.com/profile/view?id=84300665>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Grok-dev