• Hej there,
    I’m a bit confused ??

    So .. I am using qtranslate-X and I’m totally happy with it! Working fine, redirecting to Browser language ‘nd all this stuff.

    But: If I google my site and then click on my site link the redirection to the browser language does not work.

    So googling “KOMM MIT” shows https://www.komm-mit.com as first hit. I click on it, my browser is a german one – BUT the english version is shown.

    Cookies and Cache deleted before

    Any idea?

    https://www.ads-software.com/plugins/qtranslate-x/

Viewing 15 replies - 31 through 45 (of 56 total)
  • Thread Starter kraej

    (@kraej)

    I stay on the english page ??

    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?

    Thread Starter kraej

    (@kraej)

    just tried it. Did not help ?? Thanks, anyway.

    I’m still confused because typing the URL into the adress bar redirects to the german version.

    Thread Starter kraej

    (@kraej)

    @gunu: Did you have any chance to speak to you developers about the redirection problem using external links / google?

    Plugin Author Gunu

    (@grafcom)

    @kraej,

    I will ask John if he has looked at this.

    But for now try the latest beta version download here and let me know.

    Thread Starter kraej

    (@kraej)

    thanks Gunu. Tried it. Strange, now it is not redirecting at all. But it seems that it does not set a cookie at all ?!

    Plugin Author Gunu

    (@grafcom)

    see under settings – languages – advanced – cookie settings (?)

    Thread Starter kraej

    (@kraej)

    just re-installed the new version. Cookies are alright now. But it does not redirect – not even after typing the URL into the address bar ??

    Plugin Author Gunu

    (@grafcom)

    Also deactivated Qtranslate Slug?

    Thread Starter kraej

    (@kraej)

    Yes. Deactivated. Cookies and Cache cleared.

    Plugin Author Gunu

    (@grafcom)

    Typing:
    komm-mit.com/de/ = correct
    komm-mit.com/es/ = correct
    komm-mit.com/it/ = correct
    komm-mit.com/ru/ = correct

    komm-mit.com/en/ redirects to https://www.komm-mit.com = correct

    I unfortunately can not control the Dutch ??

    Thread Starter kraej

    (@kraej)

    Well .. strange. It is not working for me and also not for my colleagues in another office. So it cannot be related to my proxy or IP.

    Let’s wait what John will say? ??

    Thread Starter kraej

    (@kraej)

    Hej Gunu,

    anything new on this one?

    Cheers.

    Plugin Author Gunu

    (@grafcom)

    @kraej,

    test it with the latest Beta version, download here

    If the problem is caused by qTranslate Slug then the problem will still not resolved.

    See also release notes 3.3

    Thread Starter kraej

    (@kraej)

    Still not working ..
    so I guess I’ll have to wait til the next version with included slug functionality?

    Any timing for that?

    Cheers!

Viewing 15 replies - 31 through 45 (of 56 total)
  • The topic ‘Redirect to browser language when coming from Google’ is closed to new replies.