i think i found the problem (had been asking myself why i was redirected to the english page when i had set german to default lang).
For the Browser language redirection function, qtranslate-x uses the http_negotiate_language function of php and passes the locales for the enabled languages. For German, this is “de-DE”.
But the language code the german Browser sends in the $_SERVER[‘HTTP_ACCEPT_LANGUAGE’] Variable is only “de”. So the correct language “de” CAN NOT BE gotten by the function, because it is not passed as an possible language to the function.
Please try the following:
– open up the qtranslate_core.php
– navigate to line 412 (the function qtranxf_http_negotiate_language should start here)
– replace the function with the following:
function qtranxf_http_negotiate_language(){
global $q_config;
if(function_exists('http_negotiate_language')){
$supported=array();
$supported[]=str_replace('_','-',$q_config['locale'][$q_config['default_language']]);//needs to be the first
/* just for checking.... */
if(strlen(str_replace('_','-',$q_config['locale'][$q_config['default_language']]))>2){
$supported[]=substr(str_replace('_','-',$q_config['locale'][$q_config['default_language']]),0,2);
}
/*just for checking */
foreach($q_config['enabled_languages'] as $lang){
if($lang == $q_config['default_language']) continue;
$supported[]=str_replace('_','-',$q_config['locale'][$lang]);
/* just for checking.... */
if(strlen(str_replace('_','-',$q_config['locale'][$lang]))>2){
$supported[]=substr(str_replace('_','-',$q_config['locale'][$lang]),0,2);
}
/*just for checking.... */
}
$locale_negotiated = http_negotiate_language($supported);
//since 3.2-b3 added search, since locale may be different from two-letter code and not even started with language code.
foreach($q_config['enabled_languages'] as $lang){
$locale = str_replace('_','-',$q_config['locale'][$lang]);
if($locale == $locale_negotiated)
return $lang;
}
}else{
return qtranxf_get_browser_language();
}
return null;
}
Does this help?