From 52621c608ee1a7d3ca052d4f385b0789deaf48a6 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Thu, 28 Dec 2023 12:21:35 +0100 Subject: [PATCH] =?UTF-8?q?Made=20=E2=80=9Clocaleset=E2=80=9D=20more=20sta?= =?UTF-8?q?ndard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/site/index.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/web/site/index.php b/web/site/index.php index cdd7afa..f70e9f9 100644 --- a/web/site/index.php +++ b/web/site/index.php @@ -31,13 +31,16 @@ if (array_key_exists('HTTP_ACCEPT_LANGUAGE',$_SERVER)) { $ent=explode(';',$ent); (count($ent)<2) ? $ent[1]=1 : $ent[1]=preg_replace('/^q=/','',$ent[1])+0; $ent[0]=locale_canonicalize($ent[0]); + //echo '
'.print_r($ent,true).'
'; $langs[$ent[0]]=$ent[1]; } arsort($langs); $blang=array_key_first($langs); } +//echo $_SERVER['HTTP_ACCEPT_LANGUAGE'].' » '.$blang.'
'.N; require '../lib/supplangs.php'; +require '../lib/localemap.php'; $dlang=null; 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'; +//echo 'dlang: '.$dlang.'
'.N; -$locale=$dlang; -// il blocale è per non dover avere installate tutte le locale corrispondenti -$blocale='en_US.UTF-8'; -//putenv('LC_ALL='.$blocale); -setlocale(LC_ALL,$blocale); -bindtextdomain('masthelp','./locale/'.$locale); -textdomain('masthelp'); +$tdom='masthelp'; +$locale=localemap($dlang); +//echo $locale.'
'.N; +setlocale(LC_ALL,$locale); +bindtextdomain($tdom,'./locale'); +textdomain($tdom); +bind_textdomain_codeset($tdom,'UTF-8'); $needstrans=false;