[thelist] multi-language website

Eduardo Kienetz eduardok at gmail.com
Mon Sep 10 08:31:30 CDT 2007

On 9/10/07, Carlo Bongiovanni <carlo.bongiovanni at gmail.com> wrote:
> Hi folks,
> a customer asked to have his website in 5 different languages.
> my question is: how do i switch from one language to the other, in order to
> change menus and contents?
> which technology should i use? maybe xml..?
> i cannot imagine how to do at the moment...

If you are using PHP you should consider using gettext.
You might also check other programming languages that also support gettext.

Basically there is a function that receives the original string, looks
for a global language variable and returns its translation.
E.g.: echo i18n('I am ') . $age . i18n(' years old');

Where I didn't have gettext I just created that i18n() function.
Pre-load all translation (for the chosen language), that is, don't
query database for each phrase translation.
Now, depending on how many phrases you have, you might want to
consider using a 'per page' translation index so you don't load all

Eduardo Bacchi Kienetz
LPI Certified - Level 2

More information about the thelist mailing list