[Grok-dev] Chameleon and i18n

Vincent Fretin vincent.fretin at gmail.com
Wed Feb 10 03:14:55 EST 2010


On Tue, Feb 9, 2010 at 3:38 PM, Sylvain Viollon <sylvain at infrae.com> wrote:
> On Tue, 9 Feb 2010 15:23:12 +0100
> Souheil CHELFOUH <trollfot at gmail.com> wrote:
>
>  Hello,
>
>> I think that the request language is not taken by default so it's
>> always considered as english.
>> You can have a look here :
>> http://chameleon.repoze.org/docs/latest/i18n.html Have a look at the
>> i18n:target.
>>
>>
>
>  Or you can set target_language in your namespace on your view:
>
>  def namespace(self):
>      return {'target_language': 'fr'}

Really? You have to do this yourself?
The question is how the classic pagetemplate works in this case? I'm
really interested to know that.

In this case, maybe you can make this dynamic with:
self.request.locale.getLocaleID()
u'fr_FR'

self.request.locale is already the result of an
IUserPreferredLanguages, I think the one registered in
zope/publisher/browser.py
The code which set request.locale is in
zope.publisher/http.py:HTTPRequest.setupLocale

Vincent


More information about the Grok-dev mailing list