2009-06-30 08:10:17 +00:00
|
|
|
<?php
|
2009-06-30 09:24:29 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lang/auto.php,v 1.10 2005/02/06 00:21:30 wurley Exp $
|
2009-06-30 08:10:17 +00:00
|
|
|
|
2009-06-30 09:22:30 +00:00
|
|
|
// Language for auto-detect
|
2009-06-30 09:24:29 +00:00
|
|
|
// phpldapadmin/lang/auto.php in $Revision: 1.10 $
|
2009-06-30 08:10:17 +00:00
|
|
|
$useLang="en"; // default use english encoding, a Option in Config would be nice
|
|
|
|
|
|
|
|
// keep the beginning and ending spaces, they are used for finding the best language
|
|
|
|
$langSupport=array(" ca "=>"ca" // catalan
|
|
|
|
," ca-"=>"ca" //
|
|
|
|
," de "=>"de" // german
|
|
|
|
," de-"=>"de" // for de-at, de-ch...
|
|
|
|
," German "=>"de" // the browser Moz (1.5)submit German instead of de
|
|
|
|
," en "=>"en" // englisch
|
|
|
|
," en-"=>"en" // for en-us,en-gb,en-ca,..
|
|
|
|
," es "=>"es" // spainish
|
|
|
|
," es-"=>"es" // es-cr, es-co,....
|
|
|
|
," fr "=>"fr" // french
|
|
|
|
," fr-"=>"fr" // fr-lu,fr-ca,...
|
|
|
|
," it "=>"it" // italien
|
|
|
|
," it-"=>"it" // for it-ch (italien swiss)..
|
2009-06-30 09:22:30 +00:00
|
|
|
," ja "=>"ja" // japanese
|
2009-06-30 08:10:17 +00:00
|
|
|
," nl "=>"nl" // dutch
|
2009-06-30 09:22:30 +00:00
|
|
|
," nl-"=>"nl" // for ne-be, only one?
|
|
|
|
," pl "=>"pl" // polish
|
|
|
|
," pl-"=>"pl" // maybe exist
|
|
|
|
," pt "=>"pt-br" // brazilian portuguese
|
|
|
|
," pt-br"=>"pt-br" // brazilian portuguese
|
2009-06-30 08:10:17 +00:00
|
|
|
," ru "=>"ru" // russian
|
|
|
|
," ru-"=>"ru" // ru- exits?
|
2009-06-30 09:22:30 +00:00
|
|
|
," sv "=>"sv" //swedish
|
|
|
|
," sv-"=>"sv" // swedisch to
|
2009-06-30 09:24:29 +00:00
|
|
|
," zh-cn"=>"zh-cn" // simplified chinese
|
|
|
|
," zh-tw"=>"zh-tw" // taiwan?
|
2009-06-30 08:10:17 +00:00
|
|
|
);// all supported languages in this array
|
|
|
|
// test
|
|
|
|
|
|
|
|
$aHTTP_ACCEPT_LANGUAGE=" ".$HTTP_ACCEPT_LANGUAGE." ";
|
|
|
|
$aHTTP_ACCEPT_LANGUAGE=strtr($aHTTP_ACCEPT_LANGUAGE,","," ");// replace , with " "
|
|
|
|
$aHTTP_ACCEPT_LANGUAGE=strtr($aHTTP_ACCEPT_LANGUAGE,";"," ");// replace , with " "
|
|
|
|
$acceptMaxPos=strlen($aHTTP_ACCEPT_LANGUAGE);// initial value, no fit
|
|
|
|
//echo $aHTTP_ACCEPT_LANGUAGE."\n";
|
|
|
|
foreach ($langSupport as $key=>$value) {
|
|
|
|
$acceptAktPos=strpos($aHTTP_ACCEPT_LANGUAGE,$key);
|
|
|
|
if ($acceptAktPos!==false // the test contained the substring
|
|
|
|
&& ($acceptAktPos < $acceptMaxPos) // and is better than the one before
|
|
|
|
) { $useLang=$value ; $acceptMaxPos=$acceptAktPos;}
|
|
|
|
// echo "$key=>$value:$acceptAktPos,$acceptMaxPos\n";
|
|
|
|
}
|
|
|
|
//echo "used:$useLang\n";
|
|
|
|
include realpath ("$useLang".".php");// this should include from recode/ position
|
2009-06-30 09:22:30 +00:00
|
|
|
$language=$useLang;
|
|
|
|
//echo "language:".$langugage;
|
2009-06-30 08:10:17 +00:00
|
|
|
?>
|