[Zope] A good time to set HTTP_ACCEPT_LANGUAGE

Dieter Maurer dieter at handshake.de
Thu Feb 1 15:14:27 EST 2007


Peter Bengtsson wrote at 2007-1-30 15:17 +0000:
>My multilingo app now works with PlacelessTranslationService quite fine.
>If you change your browser setting with about:config you get the website 
>in different languages. Neat! However, what if you're in an internet 
>cafe in Kenya using a Zulu web browser and you want the pages to appear 
>in English for example?
>
>One solution is to do this::
>
>def __before_publishing_traverse__(self, object, REQUEST):
>     lang = self.getUserCookieSettingLang(default='en') # 1.
>     REQUEST.environ['HTTP_ACCEPT_LANGUAGE'] = lang
>
># 1. Trust that this is my custom function for finding out
># which language they really want to use when logged in.
>
>Problems with this approach:
>1. It has to be done for every object I publish including images, css etc.

You could use an "AccessRule" in your root object.



-- 
Dieter


More information about the Zope mailing list