[Grok-dev] i18n translation weirdness

Noe Nieto 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?'),
target_language='es')

It's not pretty, but it works.

Thanks.

--
Noe

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
>> 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
>
>
> ______________________________**_________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/**listinfo/grok-dev<https://mail.zope.org/mailman/listinfo/grok-dev>
>



-- 
---
Noe Nieto
NNieto Consulting Services
M: nnieto at noenieto.com
W: http://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...
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20120430/b601333f/attachment.html>


More information about the Grok-dev mailing list