Adding localization feature to a web-project

T

Thomas Weholt

Hi,

I'm doing a web-project using Python and was wondering how I can add a
localization option to my web-pages? Does anybody have any hints or ideas?
I'm using simpleTal/es as a template-engine.

I need to let the user specify (or download a language pack ) and customize
central text elements in a web-portal according to his/her needs.

If anybody can share some thoughts or examples on how they did this or ideas
on a system which makes such localization packs easy to maintain, that would
help alot.

Thanks in advance,
Thomas
 
T

Thomas Guettler

Am Wed, 05 Nov 2003 16:16:48 +0100 schrieb Thomas Weholt:
Hi,

I'm doing a web-project using Python and was wondering how I can add a
localization option to my web-pages? Does anybody have any hints or ideas?
I'm using simpleTal/es as a template-engine.

I need to let the user specify (or download a language pack ) and customize
central text elements in a web-portal according to his/her needs.

If anybody can share some thoughts or examples on how they did this or ideas
on a system which makes such localization packs easy to maintain, that would
help alot.

I do it like gettext (with a _() method), without using gettext:

_("the sun shines") --> "Die Sonne scheint"

Pseudo-Code:

def _(string):
user=get_user() # Problem
if user.lang=="de":
return de.translations[string]

File de.py:
translations{
"the sun shines": "Die Sonne scheint",
...
}

If you look at the "Problem" above: You need
to get to the user-data without a root-object.
This is a problem if you use zope. At least
I found no good solution.

I switched to quixote and there I have a customized
publisher, which puts some parts into the global namespace
(in a thread-save way).

Hope that's helps,
thomas
 
J

Josef Meile

Hi,

if you use zope, you can install a product named Localizer. I
have tested it and it works pretty good. The main idea of this
product is to define an object that contains two or more
versions of the page (or images if you want), then it will
automatically select the version according to your browser
prefferences or a language cookie (You can set the precedence
order).

If I'm not bad, for interface elements, like buttons and error messages,
you can define a resource table with the translation of each message.

Regards,
Josef
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top