Thread: Select language
View Single Post
  #4 (permalink)  
Old 01-01-06, 12:48 PM
eq1987 eq1987 is offline
Wannabe Coder
 
Join Date: Dec 2003
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
zit, make the dropdown form, action="changeLang.php"

next, you will need to either use a cookie/session to store their language choice, or put it in the URL

PHP Code:

/* changeLang.php */

$_SESSION['Language'] = $_POST['Language'];
// setcookie("Language", $_POST['Language'], time() + 3600);
// URL method will require you to add the QUERY STRING to all pages. might get tough
if($Language == 'English') {
  include 
'English.php';

PHP Code:

/* English.php */

$Lang = array(
 
"SiteName" => "PT",
 
"Greeting" => "Hello"
); 
PHP Code:

/* Other.php */

$Lang = array(
 
"SiteName" => "Lhsd",
 
"Greeting" => "Sjhsdf"
); 
PHP Code:

/* SomePage.php */

echo $Lang['SiteName']; // if they included English.php, this variable will be set as PT, if they included Other.php, it will be set as Lhsd 
Reply With Quote