[Zope] A good time to set HTTP_ACCEPT_LANGUAGE
Peter Bengtsson
peter at fry-it.com
Tue Jan 30 10:17:53 EST 2007
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.
2. It feels slightly risky to change the REQUEST.environ object.
Thoughts?
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
More information about the Zope
mailing list