Graham Dumpleton
grahamd at dscpl.com.au
Mon May 22 16:28:58 EDT 2006
On 23/05/2006, at 12:53 AM, Jim Gallacher wrote: > Wouter van Marle wrote: >> On Mon, 2006-05-22 at 09:53 -0400, Jim Gallacher wrote: >>> Wouter van Marle wrote: >>>> Hi all, >>>> >>>> I know it's possible through the http request for browsers to >>>> indicate >>>> preference for a language. >>>> Can anyone explain how that works? Or are there code snippets >>>> available >>>> for mod_python? >>>> >>>> My website now supports four languages (English, Dutch, Chinese >>>> Simplified, Chinese Traditional), defaulting to English. If the >>>> user >>>> wants another language, they have to select it manually. It'd be >>>> nice if >>>> I can detect there preference and default to that. >>> You want to examine the Accept-Language header, which will likely >>> be set by the browser. See RFC-2616 at http://rfc.net/ >>> rfc2616.html#s14.4 >> I found that one in the meantime as well. >> Not easy - searching for "language" on google gives heaps of >> references >> to PROGRAMMING languages... > > Including "rfc" in your search terms will help when you are looking > for information on internet protocols. My reaction when I first > started reading the RFCs was, "Oh, so that's how the internet > works". And of course your education is not complete until you've > read and thoroughly understood RFC-1149. Implementation is left to > you as an exercise. ;) FWIW, req.content_languages isn't writable. I noted that this wasn't writable in some arbitrary JIRA issue sometime ago, but didn't actually create a proper issue for it, since I don't use languages and thus wasn't sure I understood the issues and how this attribute came into play. Graham
|