Ethan Jucovy wrote:
> How about just monkeypatching the active negotiator?
> 
> {{{
> negotiator = getUtility(zope.i18n.interfaces.INegotiator)
> orig = negotiator.getLanguage
> negotiator.getLanguage = lambda foo, bar: 'fr'
> text = my_page_template()
> negotiator.getLanguage = orig
> }}}
> 
> Haven't tested it, but in my (limited) understanding of the I18N system
> something like that ought to work..

As the default negotiator is based on the request, it might be possible
to forge a different request object for the template.

Or attach a marker interface to the request and register a different
IUserPreferredLanguages adapter for it. A more specialized version
should take precedence over the normal adapter based on the HTTP header.

Hanno

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to