Answers.Body: <p><code>craft.locale</code> from a template goes to the <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/variables/CraftVariable.php#L86" rel="nofollow noreferrer"><code>locale()</code></a> method of the <code>CraftVariable</code> class, which just calls <code>craft()-&gt;language</code> from PHP, which you could use.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-21T20:13:10.367Z
Answers.LastActivityDate: 2017-08-21T20:13:10.367Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>You could easily create a hidden input and set the value to <code>&lt;input type="hidden" name="locale" value="{{ craft.locale }}"&gt;</code> and import that into the controller via <code>$locale = craft()-&gt;request-&gt;getPost('locale');</code> This will allow you to know the current selected locale in the CP. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-21T20:37:17.747Z
Answers.Text: A Very nice workaround, can't believe I didn't thought of that.
Answers.UserDisplayName: Lukigi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-21T17:57:10.087Z
Answers.LastActivityDate: 2017-08-21T17:57:10.087Z
Answers.UserDisplayName: a-am
Body: <p>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.</p>
  
  <p>Any help would be appreciated.</p>
  
Tags: <plugin-development><localization>
Title: How to get current locale in the controller
ThreadText: # How to get current locale in the controller
  
  (Asked by: username_0 on 2017-08-21)
  
  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.
  
  **Tags:** plugin-development, localization
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-08-21. Score: 3 | Accepted answer
  
  `craft.locale` from a template goes to the [`locale()`](https://github.com/pixelandtonic/Craft-Release/blob/master/app/variables/CraftVariable.php#L86) method of the `CraftVariable` class, which just calls `craft()->language` from PHP, which you could use.
  
  
  ---
  
  ### Answer by username_2 on 2017-08-21. Score: 1
  
  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.
  
  > **Comments:**
  > **username_0**: A Very nice workaround, can't believe I didn't thought of that.  
  
  ---
  
  