[Grok-dev] i18n translation weirdness
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Mon Apr 30 14:29:06 UTC 2012
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 job?')
>
> 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.
HTH
regards, jw
More information about the Grok-dev
mailing list