Made “localeset” more standard
This commit is contained in:
parent
fbed07c5ec
commit
52621c608e
1 changed files with 11 additions and 7 deletions
|
@ -31,13 +31,16 @@ if (array_key_exists('HTTP_ACCEPT_LANGUAGE',$_SERVER)) {
|
||||||
$ent=explode(';',$ent);
|
$ent=explode(';',$ent);
|
||||||
(count($ent)<2) ? $ent[1]=1 : $ent[1]=preg_replace('/^q=/','',$ent[1])+0;
|
(count($ent)<2) ? $ent[1]=1 : $ent[1]=preg_replace('/^q=/','',$ent[1])+0;
|
||||||
$ent[0]=locale_canonicalize($ent[0]);
|
$ent[0]=locale_canonicalize($ent[0]);
|
||||||
|
//echo '<pre>'.print_r($ent,true).'</pre>';
|
||||||
$langs[$ent[0]]=$ent[1];
|
$langs[$ent[0]]=$ent[1];
|
||||||
}
|
}
|
||||||
arsort($langs);
|
arsort($langs);
|
||||||
$blang=array_key_first($langs);
|
$blang=array_key_first($langs);
|
||||||
}
|
}
|
||||||
|
//echo $_SERVER['HTTP_ACCEPT_LANGUAGE'].' » '.$blang.'<br>'.N;
|
||||||
|
|
||||||
require '../lib/supplangs.php';
|
require '../lib/supplangs.php';
|
||||||
|
require '../lib/localemap.php';
|
||||||
|
|
||||||
$dlang=null;
|
$dlang=null;
|
||||||
if (preg_match('#/('.implode('|',$supplangscodes).')$#',$path,$lang)===1) {
|
if (preg_match('#/('.implode('|',$supplangscodes).')$#',$path,$lang)===1) {
|
||||||
|
@ -62,14 +65,15 @@ if (preg_match('#/('.implode('|',$supplangscodes).')$#',$path,$lang)===1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_null($dlang)) $dlang='en';
|
if (is_null($dlang)) $dlang='en';
|
||||||
|
//echo 'dlang: '.$dlang.'<br>'.N;
|
||||||
|
|
||||||
$locale=$dlang;
|
$tdom='masthelp';
|
||||||
// il blocale è per non dover avere installate tutte le locale corrispondenti
|
$locale=localemap($dlang);
|
||||||
$blocale='en_US.UTF-8';
|
//echo $locale.'<br>'.N;
|
||||||
//putenv('LC_ALL='.$blocale);
|
setlocale(LC_ALL,$locale);
|
||||||
setlocale(LC_ALL,$blocale);
|
bindtextdomain($tdom,'./locale');
|
||||||
bindtextdomain('masthelp','./locale/'.$locale);
|
textdomain($tdom);
|
||||||
textdomain('masthelp');
|
bind_textdomain_codeset($tdom,'UTF-8');
|
||||||
|
|
||||||
$needstrans=false;
|
$needstrans=false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue