This topic should be in the PHP section, and not the PHP Snippet section. Perhaps you misunderstood this sections name meaning. If you could, change your topic title to include (Move This) or something.
Anyway, you would need to creat seperate files, containing an array of phrases in each language, for example:
PHP Code:
// Array of phrases on language.en.inc
$phrase=array();
$phrase['good_afternoon'] = "Good Afternoon!";
$phrase['good_evening'] = "Good Evening!";
// ... etc.
PHP Code:
// Array of phrases on language.de.inc
$phrase=array();
$phrase['good_afternoon'] = "Guten Tag!";
$phrase['good_evening'] = "Guten Abend!";
// ... etc.
And then based by either a $_GET superglobal, or cookies, you would set the default language, like 'de' or 'en' then include the appropriate file... a simple example:
PHP Code:
<?php
$valid_languages = array('en', 'de');
if(isset($_GET['lng']) && in_array($_GET['lng'], $valid_languages)) {
include("languages/language.".$_GET['lng'].".inc");
} else {
include("languages/language.en.inc");
}
echo $phrase['good_evening'];
?>
Then you could test it by going to
http://example.com/index.php?lng=de (Not a working example; an example URL of how it would beb used on your site.)