I'm struggling to get current locale code from the controller, I would use craft.locale in the template, but craft()->locale does not do the trick.

Any help would be appreciated.

2 Answers 2


craft.locale from a template goes to the locale() method of the CraftVariable class, which just calls craft()->language from PHP, which you could use.


You could easily create a hidden input and set the value to <input type="hidden" name="locale" value="{{ craft.locale }}"> and import that into the controller via $locale = craft()->request->getPost('locale'); This will allow you to know the current selected locale in the CP.

  • A Very nice workaround, can't believe I didn't thought of that.
    – Lukigi
    Aug 21, 2017 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.