Answers.Body: <p>You can try to use the following code to loop through the locales:</p>
  
  <pre><code>{% set locales = craft.i18n.getSiteLocaleIds()%}
  
  {% for locale in locales %}
      {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}
      &lt;a href="{{ localeEntry.getUrl() }}"&gt;{{ localeEntry.title }}&lt;/a&gt;
  {% endfor %}
  </code></pre>
  
  <p>A full solution for a language switcher is described under <a href="https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher">How can I build a language switcher?</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-01T06:57:24.630Z
Answers.Text: I think it's a better idea to define the order manually with a custom array and loop through that. See code here: [How do I create a locale dropdown to switch between languages?](http://craftcms.stackexchange.com/q/877/125)
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-01T06:44:41.867Z
Answers.LastActivityDate: 2015-08-01T06:44:41.867Z
Answers.LastEditDate: 2017-04-13T12:51:00.253Z
Answers.UserDisplayName: Tom Bauer
Body: <p>Is it possible to loop through locales? For example:</p>
  
  <pre><code>{% locale in craft.locales %}
      {# get link for each locale available #}
      &lt;a href="{{ locale.getUrl }}"&gt;{{ locale.title }}&lt;/a&gt;
  {% endfor %}
  </code></pre>
  
Tags: <localization>
Title: Is it possible to loop through locales?
ThreadText: # Is it possible to loop through locales?
  
  (Asked by: username_0 on 2015-08-01)
  
  Is it possible to loop through locales? For example:
  
  ```
  {% locale in craft.locales %}
      {# get link for each locale available #}
      <a href="{{ locale.getUrl }}">{{ locale.title }}</a>
  {% endfor %}
  
  ```
  
  **Tags:** localization
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-01. Score: 4 | Accepted answer
  
  You can try to use the following code to loop through the locales:
  
  ```
  {% set locales = craft.i18n.getSiteLocaleIds()%}
  
  {% for locale in locales %}
      {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}
      <a href="{{ localeEntry.getUrl() }}">{{ localeEntry.title }}</a>
  {% endfor %}
  
  ```
  
  A full solution for a language switcher is described under [How can I build a language switcher?](https://craftcms.stackexchange.com/questions/44/how-can-i-build-a-language-switcher)
  
  > **Comments:**
  > **username_2**: I think it's a better idea to define the order manually with a custom array and loop through that. See code here: [How do I create a locale dropdown to switch between languages?](http://craftcms.stackexchange.com/q/877/125)  
  
  ---
  
  