On 11 August 2011 19:33, Robert Forkel <[email protected]> wrote:
> Yes, that's what I'm doing now. Right now it's sort of tied to the
> TemplateLoader, though - at least the way deform uses Chameleon. So
> what I do is keep the zpt renderers around and assign to
> renderer.loader.kwargs['translate'] per request - not exactly a nice
> API to do that.
You should never need to do this manually. It's handled by the framework.
What you need to do is to make sure the locale is set up for each request:
- First, the negotiator looks for the ``_LOCALE_`` attribute of
the request object (possibly set by a view or a listener for an
:term:`event`).
- Then it looks for the ``request.params['_LOCALE_']`` value.
- Then it looks for the ``request.cookies['_LOCALE_']`` value.
- Finally, the negotiator returns ``None`` if the locale could not
be determined via any of the previous checks (when a locale
negotiator returns ``None``, it signifies that the
:term:`default locale name` should be used.)
You can subscribe to the ``INewRequest`` event to set this up per request.
\malthe
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.