Location: PHPKode > projects > Give One. Get Two. > give1get2/services/i18n/i18n_dispatcher.php
<?php // Licence Publique Générale GNU (GNU General Publique License), Copyright 2009 Geffrotin Yann

  // Langues
  
  $langDefault = "fr"; // "fr" ou "en" (French by Default)
  
  // que sous PHP 4 !!

  if(isset($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'])) {
    $lang1 = substr($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'],0,2);
    $lang2 = substr($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'],3,2);
    
    if($lang1 != "en" and $lang1 != "fr"){
      if($lang2 != "en" and $lang2 != "fr"){
      	if(isset($_SESSION["lang"])){
			$lang = $_SESSION["lang"];
		}else{
			$lang = $langDefault;
		}
      }else{
      	if(isset($_SESSION["lang"])){
			$lang = $_SESSION["lang"];
		}else{
        $lang = $lang2;
		}
      }
    }else{

      if(isset($_SESSION["lang"])){
			$lang = strtolower($_SESSION["lang"]);
		}else{
			$lang = $lang1;
		}
    }
  }else{
    $lang = $langDefault;
  }

  if(isset($_GET["lang"])){
    $Choixlang = strtolower($_GET["lang"]);
    if($Choixlang == "en" or $Choixlang == "fr"){
      $lang = $Choixlang;
      $_SESSION["lang"] = $Choixlang;
    }
  }
  
  if(isset($_SESSION["lang"])){
    $lang = $_SESSION["lang"];
  }
  
  ?>
Return current item: Give One. Get Two.