<?php 
$LocaleMechanism = 'onefile'; 
$LocalePath = './onefile/'; 
$nativeLocale = 'en_US'; 
 
include_once 'rfc1766.class.php'; 
$oRfc1766 = new rfc1766_class; 
$_SESSION['oRfc1766'] = $oRfc1766; 
include_once 'i18n.class.php'; 
$oI18N = new I18N_class; 
$_SESSION['oLang'] = $nativeLocale; 
 
if(isset($_POST['locale'])){ 
  setcookie('ex_1-locale',$_POST['locale'],time()+2592000); // This expiration time is 30 days. 
  $locale = $_POST['locale']; 
}elseif (isset($_COOKIE['ex_1-locale'])) 
  $locale = $_COOKIE['ex_1-locale']; 
else 
  $locale = $nativeLocale; 
 
eval ($oI18N->XL('Example1', '$example', $locale)); 
?> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
  <title><?=$example?></title> 
</head> 
 
<body> 
<? 
  eval ($oI18N->XL('SelectLang', '$selectLang', $locale)); 
  eval ($oI18N->XL('Submit', '$submitCap', $locale)); 
  $pwd = 'ABcdE'; 
  eval ($oI18N->XL('YourPwdIs', '$yourPwdIs', $locale)); 
?> 
  <h2><?=$example?></h2> 
  <form name="example" method="post" enctype="multipart/form-data" action="example_1.php"> 
<?  $language = $oI18N->GetLocales(); ?> 
    <?=$yourPwdIs?><br /><br /> 
    <?=$selectLang?> 
    <select name="locale" tabindex="1"> 
<? 
      foreach($language as $code => $name){ 
        if($code == $locale) 
          print "<option selected=\"true\" value=\"$code\">$name</option>"; 
        else   
          print "<option value=\"$code\">$name</option>"; 
      }  
?> 
    </select><br /> 
    <input name="submit" type="submit" value="<?=$submitCap?>" tabindex="2" /> 
  </form> 
</body> 
</html> 
 
 |