Jump to content

AJAX response in multilingual site


matjash
 Share

Recommended Posts

 

18 minutes ago, matjash said:

Does anybody know how to output AJAX response in multilingual site.

On the home page I call another page which has if($config->ajax) {...} code.

The response is always in the default language.

 

I am not a big multi-language user, but what I have done previously is to add this to the ajax URL:

&lang=es

and then in the file that is called:

$user->language = $languages->get($sanitizer->selectorValue($input->get->lang));

 

Link to comment
Share on other sites

Thank you. This works. I was thinking in the right direction. I just hoped that there is some better solution, cause my code get's little ugly this way.

I have to define javascript window.variable which I pass to javascript file (in strict mode), which calls for ajax response.

Cookie should work too I guess. If I set a cookie on language change, but this also woldn't be neat solution.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...