[Zope] Re: Hmm... Localizer or Localizer
Chris Withers
chris at simplistix.co.uk
Wed Sep 6 06:04:42 EDT 2006
Peter Bengtsson wrote:
>> 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 :)
Urm, no, sorry, don't buy that. The docs are pretty good...
> So, should I use PTS or not??
You do whatever you want, just don't come crying to us when you're
screaming in pain with PTS ;-)
(of course, it may "just work" for you, in which case you're lucky)
> "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.
Knocking up a negotiator that does what you want is pretty easy. I
already offered to send you code that does what you want...
> When I send out email alerts to people in my
> app, that's a wget script that kicks if off, not a Mozilla browser.
What has this got to do with anything?
(although, fwiw, url whacking is dumb, don't do that, look at Stepper
and tricker it with cron)
> 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"
> />
Then it's time for you to read more FM. This is all explained, from what
I remember.
> Please tell me there's a function or something that works like this::
>
> def index_html(self):
> uid = self._getLoggedinUID()
> wants_lang = self._getUserPreference(uid, default='en')
> setCurrentLanguage(wants_lang)
> return _("I wish it was easier")
>
> def manage_setUserPreference(self, uid, lang):
> if lang in getAvailableLanguages():
> self._setUserPreference(uid, lang)
>
> Where _getUserPreference() and _setUserPreference() is something I'm
> expected to write for my app.
No, it's not quite like this, but it is just as easy.
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope
mailing list