Salve, mi servirebbe integrare nel seguente script tutte le lingue del traduttore
Codice PHP:
<?php
$default = 'lg/styled/';
$redirect = array('fr' => 'lg/styled-2/',
'it' => 'lg/',
'es' => 'lg/styled-4/',
'de' => 'lg/styled-3/', );
## / config ##
// get the language string proposed by the browser if there is one
function lang_from_browser() {
// it;q=1.0,fr;q=0.9,en;q=0.8 OR fr-ch
$lang_list = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
//echo $lang_list ;exit();
$lang_block = explode(',', $lang_list);
$lang_ar = array();
foreach ($lang_block as $t) {
array_push($lang_ar, strtolower(substr(trim($t), 0,2)));
}
return $lang_ar;
}
// redirect to the browser language if there is one
function redirect($lang){
global $redirect;
if(count($lang) > 0){
foreach($lang as $l){
if(array_key_exists($l,$redirect)){
header('Location: '.$redirect[$l]);
die();
}
}
}
return true;
}
## redirect ##
if(redirect(lang_from_browser())){
header('Location: '.$default);
die();
}
?>
è possibile farlo ???
grazie in anticipo