I need to supply different translations of website content. For website elements, I thought it would be fastest to keep a PHP file with associative array like:
$lang['login']= 'Login';
$lang['logout']= 'Log Out';
$lang['home']= 'Home';
etc...
Then, tracking the &lang= variable in URL I can dynamically load language arrays. For english (&lang=en) I would load en.lang.php. For french fr.lang.php, etc... Then, for proper page elements I'd echo appropriate $lang[] elements which contain language as loaded according to &lang= var passed in URL, with english as default.
My problem is this:
Either I need to supply charset string with each language PHP, the string that will be echoed in http-equiv meta tag, or I use global utf-8.
If I use charsets, I cannot solve for situations where more than one language is shown up on a page (for instance in forums, if users use their own characters for whatever reason, these will be improperly encoded).
If I use utf-8, I solve for multiple languages on a page, but I don't know how to encode the PHP files. The problem is, each of translators will run (most likely) Windows with their local codepages, and txt files that I would supply them with for translation do not contain multibyte characters. I don't know if Word, Winword or Notepad can save in utf-8, as I will require them to save plaintext files that I'll check and save as .lang.php files.
One solution that I see is having every string for translation stored in temporary database table, have the translators use the web interface (utf-8 encoded), and have the ability to export a PHP file from such a database.
Can anyone give me an advice, or their own experience? Thanks.