[Zope] Re: Hmm... Localizer or Localizer

Philipp von Weitershausen philipp at weitershausen.de
Tue Sep 5 15:09:46 EDT 2006


Peter Bengtsson wrote:
>> HTTP_ACCEPT_LANGUAGE isn't a variable. It's an HTTP header
>> (Accept-Language) that you really shouldn't modify. The request should
>> be treated as read-only.
>>
>> To test languages, either write your own IUserPreferredLanguages adapter
>> that returns the language you want or simply configure your browser to
>> send a different Accept-Language header. In Firefox, you can simply do
>> this by entering "about:config" in the URL bar and changing the setting
>> of the intl.accept_languages variable (e.g. to "se, en").
>>
>> > Either I've missed something big and crucial or there's a bug in lack
>> > of errors or alerts.
>>
>> You simply didn't read Five/doc/i18n.txt
>> (http://codespeak.net/z3/five/i18n.html). Googling "five i18n" gives you
>> that as a first hit. "RTFM" is all I can say here.
>>
> Don't RTFM me! I've read that page and unless you have a PhD in
> physics and indept experience of Zope 3 is really doesn't make a lot
> of sense. Plus, I've got your cookbook at home :)

You must be confusing me. I don't have a PhD in physics and I didn't 
write a cookbook. That was the other German ;).

> So, should I use PTS or not??

No. I think I've answered that question before.

> "The default behaviour for choosing languages in Five is the one of
> Zope 3: analyze the Accept-Language HTTP header and nothing more."
> This is not good enough.

Then implement your own IUserPreferredLanguages adapter. This is 
documented in my book which you may or may not have, not sure ;)

> When I send out email alerts to people in my
> app, that's a wget script that kicks if off, not a Mozilla browser.
> Besides, what if an Englishman is using a Swedish
> internetcafe-computer when on holiday; in that case I want to allow
> him to manually configure his user profile on my site.

Sure. That's possible. With a custom IUserPReferredLanguages adapter.

> I have no idea what this does or what I'm supposed to do with:
> <adapter
>    for="zope.publisher.interfaces.http.IHTTPRequest"
>    provides="zope.i18n.interfaces.IUserPreferredLanguages"
>    factory="Products.Five.i18n.PTSLanguages"
>    />

Nothing. The docs say that this is only for users who use PTS for 
legacy. You're not one of them.

Philipp


More information about the Zope mailing list