Though I am no expert at multi lingual websites by any means, I'll post a reply to get you thinking since noone has for the past 24 hours. I would love to hear others opinions on this and any tricks that can be used to make this more easier.
From a design standpoint, I would feel that you need to create a user interface that can accept any language. I know when I used to develop Microsoft Windows applications, that we used to have separate resource DLLs to hold each foreign language strings (like English.DLL, French.DLL, Russian.DLL, etc.). We would create our English DLL first with all the strings in it, and then hand it over to hired translators who manually went in and created the french, russian, etc. DLL equivalents by changing the strings to their local language. We then had to be conscious of using multibyte string functions.
From a PHP perspective, this means that you need to be very disciplined about separating code from data. Its definitely something you have to design in the early stages because if you don't its an ugly modification!
Language strings need to be placed in separate files. You will also need to structure a file hierarchy so you can find those language files easily. So for example, you could do this (assuming Apache file structure):
/htdocs
/htdocs/mysite.com
/htdocs/mysite.com/images
/htdocs/mysite.com/framework
/htdocs/mysite.com/modules
/htdocs/mysite.com/lang
Under the lang folder it could look something like this:
/htdocs/mysite.com/lang
/htdocs/mysite.com/lang/english
/htdocs/mysite.com/lang/french
/htdocs/mysite.com/lang/german
/htdocs/mysite.com/lang/russian
When the user chooses a language type from say a preference form, you can store his setting in a cookie or in your database (if you use a login authentication database). When the next time he comes to visit you know his language preference. You require_once($langFile) into all of your php files.
Where:
$lang = "english";
$langFile = "lang/" . $lang;
By making $lang change immediately to the requested language, you can simply read in the file and have the php interpreter/compiler resolve those reference strings at run time.
Each language resource file could look like this (here's English for example):
lang["ID1"] = "Welcome to MySite.com";
lang["ID2"] = "Error!";
lang["ID3"] = "Go";
lang["ID4"] = "Stop";
.
.
lang["ID199"] = "Sorry but your request is not accepted."
lang["ID200"] = "Exiting program. Goodbye!";
Inside your php files, you simply use those language references. They will resolve to different language modules according to the users' preference.
For example:
Login.php
require_once("framework.php");
$lang = Framework_GetLangPref();
$langFile = "lang/" . $lang;
require_once($langFile);
.
.
echo $lang["ID200"];
.
.
SplashScreen.php
require_once("framework.php");
$lang = Framework_GetLangPref();
$langFile = "lang/" . $lang;
require_once($langFile);
.
.
echo $lang["ID1"];
.
.
Framework_GetLangPref() would be a function that retrieves the users preferred language setting. For example, that setting maybe stored in the database per user account. Framework_GetLangPref() would be a call to a mySql database that would pull out that particular users language preference. You probably want to hold the language preference in a session variable/cookie.
I hope this makes sense!