Answers.Body: <p>The <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/craft.js#L4138" rel="nofollow"><code>BaseElementSelectorModal</code></a> class takes a second parameter <code>settings</code>, which can include a <code>criteria</code> object. This <code>criteria</code> object is used to create an <a href="https://buildwithcraft.com/classreference/models/ElementCriteriaModel" rel="nofollow">ElementCriteriaModel</a> on the server, which means it can have any property an ElementCriteriaModel can have – including <code>locale</code>:</p>
  
  <pre><code>var currentLocale = Craft.getLocalStorage('BaseElementIndex.locale') || Craft.locale;
  
  var modal = Craft.createElementSelectorModal('Entry', {
      criteria : {
          locale : currentLocale
      }
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-21T16:46:49.593Z
Answers.Text: Can you get the CP's currently selected locale form the js Craft class?
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-21T16:49:00.893Z
Answers.Text: Yeah - its in the answer above; Craft.locale
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-21T16:49:42.673Z
Answers.Text: That only grabs the CP's locale not the currently select locale in the edit entry view.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-21T17:06:28.723Z
Answers.Text: @aran Sorry, didn't understand that you were looking for the current element index locale. The easiest (only) way I know how to do that, is to look in `localStorage` – just updated my answer.
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-29T18:19:07.403Z
Answers.Text: It appears the only way to get the current selected locale from an entry edit screen is via the local hidden input, which is not the same as BaseElementIndex.locale.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-20T09:20:54.657Z
Answers.LastActivityDate: 2016-03-21T17:05:36.500Z
Answers.LastEditDate: 2016-03-21T17:05:36.500Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>When using <code>createElementSelectorModal()</code> in a plugin, how do you make your source list show items from the current locale selected in the CP? It only seems to show the items from default locale no matter what locale you have selected.</p>
  
Tags: <plugin-development><localization><modal><garnish>
Title: When using "createElementSelectorModal()" how do you respect selected locale?
ThreadText: # When using "createElementSelectorModal()" how do you respect selected locale?
  
  (Asked by: username_0 on 2016-03-18)
  
  When using `createElementSelectorModal()` in a plugin, how do you make your source list show items from the current locale selected in the CP? It only seems to show the items from default locale no matter what locale you have selected.
  
  **Tags:** plugin-development, localization, modal, garnish
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-20. Score: 2 | Accepted answer
  
  The [`BaseElementSelectorModal`](https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/craft.js#L4138) class takes a second parameter `settings`, which can include a `criteria` object. This `criteria` object is used to create an [ElementCriteriaModel](https://buildwithcraft.com/classreference/models/ElementCriteriaModel) on the server, which means it can have any property an ElementCriteriaModel can have – including `locale`:
  
  ```
  var currentLocale = Craft.getLocalStorage('BaseElementIndex.locale') || Craft.locale;
  
  var modal = Craft.createElementSelectorModal('Entry', {
      criteria : {
          locale : currentLocale
      }
  });
  
  ```
  
  > **Comments:**
  > **username_0**: Can you get the CP's currently selected locale form the js Craft class?  
  > **username_1**: Yeah - its in the answer above; Craft.locale  
  > **username_0**: That only grabs the CP's locale not the currently select locale in the edit entry view.  
  > **username_1**: @aran Sorry, didn't understand that you were looking for the current element index locale. The easiest (only) way I know how to do that, is to look in `localStorage` – just updated my answer.  
  > **username_0**: It appears the only way to get the current selected locale from an entry edit screen is via the local hidden input, which is not the same as BaseElementIndex.locale.  
  
  ---
  
  