matjash Posted December 27, 2016 Posted December 27, 2016 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.
adrian Posted December 27, 2016 Posted December 27, 2016 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));
matjash Posted December 27, 2016 Author Posted December 27, 2016 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now