Possible to change locale in PHP? I've got a plugin which is defaulting to English during AJAX calls, but I need it to stick to whatever the current language is. I can send the current locale through via AJAX data, but I'm not sure how to change the locale in PHP.

It's possible to get the current locale like this...

craft()-&gt;getLanguage()


Is there a way to set the current locale in PHP?
I think I got this resolved the proper way... looks like you just need to make sure that your AJAX calls are localized.

In my main _layout template:

&lt;script type="text/javascript"&gt;
window.siteUrl = "{{ siteUrl }}";
&lt;/script&gt;


Then in my JS, I have this:

$.post(
    siteUrl + 'actions/myPlugin/myAction',
    ...
);


As long as your siteUrl is being localized properly, it should trickle down into the JS... and the localized AJAX path can then load a properly localized template.