qtranslate loading the wrong language

I have the following problem. I'm translating a website in 2 languages - Bulgarian and English.

Let say that I search a page in Bulgarian. The results that google disply are in Bulgarian language, but when I click on one of the links(google results) it loads the English version of the page, not Bulgarian.

I'm looking for a solution for this problem, but I can't find anything.

Topic translation plugin-qtranslate Wordpress

Category Web


Problem is that events callendar is inited before qtranslate, Tribe__Events__Main::instance() :

       // let's initialize tec silly-early to avoid fatals with upgrades from 3.x to 4.x
        add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 0 );

simple hack was to create a plugin named 1fix with code:

 add_action( 'plugins_loaded', '__fix_tribe_init', 0 );

  function __fix_tribe_init(){
     global $locale;

     if(preg_match('/^\/ru\//',$_SERVER['REQUEST_URI'])) {
         $locale = 'ru_RU';
     } 
}

that completely solved my problem

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.