[Zope] Could Someone Clean This DTML Up?

Oliver Bleutgen myzope@gmx.net
Wed, 08 Jan 2003 19:46:50 +0100


beno wrote:
> At 02:18 PM 1/6/2003 -0500, you wrote:
>> Bear in mind that "lang" is not going to be just "en" or whatever, and a
>> basic "en' may occur in several variations.  You will probably want to
>> do some string processing on it before doing your comparison.
> 
> Well, actually, no. What I'm building is a product for people who are 
> new to Zope that want a quick, easy template for building "brochureware" 
> sites, one that will also serve as a tutorial. In such sites, the 
> content rarely changes and it isn't too much to deal with anyway. There 
> are good Zope products out there that do translation that people who 
> need industrial strength can use ;)

Well, the problem is that your code won't work in a lot of cases. This 
isn't about industrial strength, it's about getting even a working 
prototype.

This is what my browser sends for that header:

en-us, de;q=0.50

If you haven't configured the browser, it may send nothing for that header.
I'd at least do something like

try:
   lang = context.REQUEST['HTTP_ACCEPT_LANGUAGE'][0:2]
except:
   lang = 'en'

in a python script.

cheers,
oliver