Answers.Body: <p>Yes, it's possible with a plugin.
  Make it listen to <code>onBeforeSaveEntry</code> events and look up how often the entry was already saved by counting entry versions using the <code>getVersionsByEntryId</code> method.
  If it is the entry's second save (one version exists) overwrite the slug with an empty string (will generate a new slug from the title).</p>
  
  <p>You should add another conditional to only make it generate a new slug for all locales but the one you first saved in (not exactly sure how to get this), but this should get you started:</p>
  
  <pre><code>public function init()
  {
      parent::init();
  
      craft()-&gt;on('entries.onBeforeSaveEntry', function(Event $event)
      {
          $entry = $event-&gt;params['entry'];
  
          if ($entry-&gt;id)
          {
              $versionsCount = count(craft()-&gt;entryRevisions-&gt;getVersionsByEntryId($entry-&gt;id, $entry-&gt;locale));
          }
  
          // $localeFirstSave = ??
          // if ($entry-&gt;locale != $localeFirstSave)
  
          if (isset($versionsCount) &amp;&amp; $versionsCount == 1)
          {
              $entry-&gt;slug = '';
          }
      });
  }
  </code></pre>
  
  <p>another variant you could try is to always load the JS that generates the slug on the fly:</p>
  
  <pre><code>public function init()
  {
      if (craft()-&gt;request-&gt;isCpRequest())
      {
          craft()-&gt;templates-&gt;includeJs('window.slugGenerator = new Craft.SlugGenerator("#title", "#slug");');
      }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T18:26:14.817Z
Answers.Text: If anyone knows how to get the locale an entry was first saved in, please feel free to edit my answer.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-06T11:15:43.910Z
Answers.Text: @Gogster maybe a solution that always makes the slug generate on title edits works better for your client?
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T18:19:45.450Z
Answers.LastActivityDate: 2015-02-06T11:12:49.183Z
Answers.LastEditDate: 2015-02-06T11:12:49.183Z
Answers.UserDisplayName: carlcs
Body: <p>When an entry is created and saved in a locale the corresponding entry is created for other locales using the original title. However, when the title of the locale which needs translating is edited the slug isn't auto generated from the new localised title and remains in the original language.</p>
  
  <p>Of course, the slug can be manually edited but unfortunately the likelihood is that users won't bother, or forget, meaning that the urls for entries won't be localised.</p>
  
  <p>What would be ideal is that on the first edit of the localised version that the slug is auto generated from the title as it is for the initial entry. Is this possible either via a plugin or could it be considered in a future version?</p>
  
Tags: <localization><slug>
Title: Auto generation of localised slug
ThreadText: # Auto generation of localised slug
  
  (Asked by: username_0 on 2015-02-05)
  
  When an entry is created and saved in a locale the corresponding entry is created for other locales using the original title. However, when the title of the locale which needs translating is edited the slug isn't auto generated from the new localised title and remains in the original language.
  
  Of course, the slug can be manually edited but unfortunately the likelihood is that users won't bother, or forget, meaning that the urls for entries won't be localised.
  
  What would be ideal is that on the first edit of the localised version that the slug is auto generated from the title as it is for the initial entry. Is this possible either via a plugin or could it be considered in a future version?
  
  **Tags:** localization, slug
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-02-05. Score: 3
  
  Yes, it's possible with a plugin.
  Make it listen to `onBeforeSaveEntry` events and look up how often the entry was already saved by counting entry versions using the `getVersionsByEntryId` method.
  If it is the entry's second save (one version exists) overwrite the slug with an empty string (will generate a new slug from the title).
  
  You should add another conditional to only make it generate a new slug for all locales but the one you first saved in (not exactly sure how to get this), but this should get you started:
  
  ```
  public function init()
  {
      parent::init();
  
      craft()->on('entries.onBeforeSaveEntry', function(Event $event)
      {
          $entry = $event->params['entry'];
  
          if ($entry->id)
          {
              $versionsCount = count(craft()->entryRevisions->getVersionsByEntryId($entry->id, $entry->locale));
          }
  
          // $localeFirstSave = ??
          // if ($entry->locale != $localeFirstSave)
  
          if (isset($versionsCount) && $versionsCount == 1)
          {
              $entry->slug = '';
          }
      });
  }
  
  ```
  
  another variant you could try is to always load the JS that generates the slug on the fly:
  
  ```
  public function init()
  {
      if (craft()->request->isCpRequest())
      {
          craft()->templates->includeJs('window.slugGenerator = new Craft.SlugGenerator("#title", "#slug");');
      }
  }
  
  ```
  
  > **Comments:**
  > **username_1**: If anyone knows how to get the locale an entry was first saved in, please feel free to edit my answer.  
  > **username_1**: @username_0 maybe a solution that always makes the slug generate on title edits works better for your client?  
  
  ---
  
  