Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by guyK 6 years, 6 months ago.

Assigned support staff: Minesh.

Author Posts
August 8, 2014 at 2:56 am #449329

guyK

The Ajax locale serving the default language is a generic problem.
It should be set by _COOKIE['_icl_current_language'] automatically,
And not only ajax, any default should consider the cookie, as welll as $_REQUEST["lang"].
My hack to replace the default choice is as follow in sitepress-multilingual-cms/sitepress.class.php
around line 440 you reach default choice for non admin (the admin part is more complex (??)

   }else{ 
    $this->this_lang = $this->get_default_language();
   }

I replaced it by

}else{ 
  $this->this_lang = $this->get_default_language();
  //doesntwork? if(defined('DOING_AJAX')) anyway: default for all
  {
    $al = $this->get_active_languages();
    if(isset($_REQUEST['lang']) && isset($al[$_REQUEST['lang']])){
      $this->this_lang = $_REQUEST['lang'];
    }else{
      $this->this_lang = $this->get_language_cookie();//test exists?
    }
  }
}

Can it be implemented like that in wpml plugin ?

Guy Kastenbaum - Paris

August 8, 2014 at 8:59 am #449471

Minesh
Supporter

Hello guyK,

Thank you for contacting WPML support!!

We believe you are using older version of WPML. We would like to check that.

In order to investigate your issue, Can you please let us answer following questions:
=> Can you please share screen shot of WPML => Support Page
=> Can you please tell us what is your WordPress version?

Thanks,
Minesh
OnTheGoSystems – Support Department

August 8, 2014 at 12:11 pm #449634

guyK

Thanks for responding,

my versions are up to date I believe :
WPML Multilingual CMS Version 2.9.3
WordPress 3.9.2 running DynamiX theme

My problems were on a sabai-directory which is officially known NOT compatible with WPML.
But asmy fix can make a lot of plugins ajax based more compatibles,
You can just change
$this->this_lang = $this->get_default_language();
by
$this->this_lang = $this->get_language_cookie();
or add an option or a hook at this part of code to make it a standard.

Thanks for reading, and for this useful and reactive forum.