[Zope] Use of HTTP_ACCEPT_LANGUAGE in Zope

Sin Hang Kin kentsin@macau.ctm.net
Wed, 8 Mar 2000 16:17:46 +0800


I am making a new head zope index_html file, I think it is now about time to
make use of the HTTP_ACCEPT_LANGUAGE which is sent by the browser to
indicate the perferred language.

The variable is a string like:

lang1, lang2;q=p1,lang3;q=p2....

while lang1, lang2, lang3 is the perferenced languages.

I have think of the following ways to make such brenches in zope:

1. by setting the lang variable in the REQUEST
2. by transfer to the brench of lang/
3. brench calls of index_lang

What will be the perferred way to make such a brench? I want to hear from
all.

In building the brench code : I have come up with the code:

<dtml-in "_.string.split(HTTP_ACCEPT_LANGUAGE, ',')">
   .....do thing according to sequence-item
</dtml-in>

but on the second argument, the sequence-item may contain ;q=0.5 which need
to be trancated. How can I trancated that in dtml?

Rgs,

Kent Sin