views:

69

answers:

3

Hi,

I have been working on a site from last 2 years.
Now my client want's make it bilingual, with English and Chinese.

Any idea what should I do for it?

+1  A: 

Decent introduction article on the subject:

http://onlamp.com/pub/a/php/2002/11/28/php_i18n.html

We could really do with more info.

Rushyo
+2  A: 

You can have seperate constant files, each file has a bunch of constants in it, then you go through the pages replacing actual sentences with the constants.

Have a cookie that selects the correct constants file that the user has chosen.

This sort of design is good as it allows for more language to be added easily in the future.

It is however a pain in the ass to do.

You could go for some sort of automated translator but it wont read naturally.

Tom Gullen
+1  A: 

I had to do this and since you are working with PHP, I recommend gettext

http://php.net/manual/en/book.gettext.php

And here's an article to get you started on it

http://mel.melaxis.com/devblog/2005/08/06/localizing-php-web-sites-using-gettext/

The benefit of gettext is that the translator never has to touch the code. Rather, the translator works by translating .po files with Poedit ( http://www.poedit.net/ ). You place those .po files in your locale directories from which php-gettext accesses and uses it to replace the strings. Have fun and good luck, I got it to work pretty well

Axsuul