Click to See Complete Forum and Search --> : Bilingual Website


oo7ml
01-05-2010, 11:55 AM
Hi, my client has asked me to build a bilingual website for him. I have completed the design and xhtml coding. I have two buttons at the top of the page (English | Spanish)

My client has sent me all of the content which i need to hard code into the pages as he does not want a CMS. The document contains the English text for each page along with the SPanish text for each page.

What should i do. Should i basically create a duplicate page for each page on the site, e.g services_eng.html and services_esp.html or has anyone got any other alternatives...

I usuall divide the sections (header & footer) of my pages into php includes so this will also mean that i will need to do this twice also.

any suggestions will be greatly appreciated... thanks in advance

sushi
01-05-2010, 12:03 PM
you can set up a database and a table with 3 columns: (Section, english, spanish) and grab the data accordingly.

if you dont want to set up a database you can always say


if($english){
echo 'Hello';
}else{
echo 'Hola';
}


where you control $english with a cookie or a url param like ?language=sp


$english = true;
if($_GET['language']=='sp'){$english = false;}

tracknut
01-05-2010, 12:37 PM
I've seen a lot of solutions to this problem, there doesn't seem to be a consistent "right" way. I have a site in english and french. What I do is:

- Store the text in XML, tagged with attributes "en" or "fr" accordingly
- Collect and save the user's preferred language, either from a saved session variable (created when the user clicks on the little US or French flag) or from HTTP_ACCEPT_LANGUAGE
- Code the pages to pull their text from the XML file, with routines that grab the English or French text based on the preferred language.

This works decently well, probably the same as a database implementation. The only downside is that every bit of text output for the page has to be encoded in the XML, twice.

Dave

oo7ml
01-05-2010, 01:02 PM
Cool, thanks for the reply, i think i might try the cookie or a url param option, thanks again for your help...