Roundup Tracker - Issues

Issue 1360321

classification
translate web interface using browser language
Type: Severity: normal
Components: None Versions:
process
Status: closed accepted
:
: : a1s, hfoffani
Priority: normal : patch

Created on 2005-11-18 17:26 by hfoffani, last changed 2005-12-03 10:32 by a1s.

Files
File name Uploaded Description Edit Remove
accept_language_patch.txt hfoffani, 2005-12-02 14:58 the patch.
accept_language.py hfoffani, 2005-12-02 14:59 this one goes under roundup/cgi
Messages
msg2772 Author: [hidden] (hfoffani) Date: 2005-11-18 17:26
Given that roundup has now many translations 
available, I thought that it would be nice to make 
Roundup's web frontend checks the user browser 
language on-the-fly and displays the appropiate 
messages.

I'm including here one patch and a new file.

The new file is accept_language.py.  It parses the 
content of the language header sent by the browser and 
builds a list of language codes ordered by the user 
language preference suitable for gettext & co.  I 
copied the file under roundup's cgi directory.  It 
follows the spec at 
http://www.w3.org/Protocols/rfc2616/rfc2616-
sec14.html#sec14.4 (I hope!)
It uses a PriorityQueue to order by quality value. I 
may change that to python's heapq given that Roundup 
is requires python2.3 now.

The patch is for client.py.  It traps the 'Accept-
Language' request header and makes the tranlation 
object.  It's minimal but it works.  I think that more 
discussion and knowledge on roundup's cgi internals is 
needed before it gets into trunk.
msg2773 Author: [hidden] (hfoffani) Date: 2005-12-02 14:50
Logged In: YES 
user_id=112690

Deleting the patches as I'm going to update them.
msg2774 Author: [hidden] (hfoffani) Date: 2005-12-02 14:56
Logged In: YES 
user_id=112690

The new patch adds the HTTP_ACCEPT_LANGUAGE env to follow 
the CGI standard.  It also adds a config option to toogle 
this feature on.

The patch adds a method to the Client class.  I don't know 
if it's ok for you guys, I just tried to make the patch 
less invasive.

The file accept_language.py, which goes under the 
roundup/cgi directory, is a bit better than the previous 
version.

msg2775 Author: [hidden] (hfoffani) Date: 2005-12-02 15:01
Logged In: YES 
user_id=112690

BTW, the patch is against 2005/12/02 trunk.
msg2776 Author: [hidden] (a1s) Date: 2005-12-03 10:32
Logged In: YES 
user_id=8719

i've changed default value for web.use_browser_language
config setting from "no" to "yes".

checked in.  thanks a lot!
History
Date User Action Args
2005-11-18 17:26:31hfoffanicreate