[mod_python] advice for a multilingual app

Baurzhan Ismagulov ibr at radix50.net
Sat Aug 19 06:52:36 EDT 2006


Hello Graham,

On Sat, Aug 19, 2006 at 09:03:04AM +1000, Graham Dumpleton wrote:
> PSP has some issues with Unicode

Oh, thanks for the alert! If I understand
http://www.mail-archive.com/[email protected]/msg33443.html
correctly, Publisher handler is the only way to get Unicode working with
mod_python. If I have to use Publisher, it makes sense to look at
Django. It's a pity I don't have time to add Unicode support to flex :) .


> and you would have to build your framework for supporting multiple
> languages.

Well, the framework is as simple as following ('ru' is embedded anywhere
in the request):

<%
import gettext
dir = req.hlist.directory
gettext.install('i18n', dir, unicode=True)
gettext.translation('i18n', dir, languages=['ru']).install()
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title><%=_('abc')%></title>
...

I did ab -c 100 -n 10000 http://medeu/~ibr/test/02-gettext.html vs.
02-static.html, the difference is 510 to 718 RPS. So a little script
replacing <%_('.*')%> with the actual text in the chosen language would
be all I wanted. Can I pre-generate and reference pages in different
languages with Django?


With kind regards,
Baurzhan.


More information about the Mod_python mailing list