Answers.Body: <p>I probably don't fully understand what you're trying to acchieve, but to get to the index page of your current locale, you'd simply use <code>siteUrl()</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-21T17:22:18.157Z
Answers.LastActivityDate: 2015-02-21T17:22:18.157Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>When calling this:</p>
  
  <pre><code> {% set locale = craft.i18n.getCurrentLocale() %}
  </code></pre>
  
  <p><code>locale</code> is set to a full blown <a href="http://buildwithcraft.com/classreference/models/LocaleModel" rel="nofollow">LocaleModel</a> object.</p>
  
  <p>What you're probably looking for is its <a href="http://buildwithcraft.com/classreference/models/LocaleModel#getId-detail" rel="nofollow">getId()</a> method.</p>
  
  <pre><code>craft.config.siteUrl[locale-&gt;getId()]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-22T09:14:53.273Z
Answers.Text: Thanks Brad for your respond and time. To get a index link of a locale was simply to use `siteUrl()`.
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-21T17:20:39.143Z
Answers.LastActivityDate: 2015-02-21T17:20:39.143Z
Answers.UserDisplayName: Brad Bell
Body: <p>I have two menus.
  One with countries, one with navigation.</p>
  
  <p>Navigation menu must to have a index link of a active locale. 
  So if I'm at example.com/uk/section and I go to navigation menu and click at index link, I get index of /uk</p>
  
  <p>My countries menu code is:</p>
  
  <pre><code>{% set locales = ['en', 'en_gb', 'sk'] %}
      {# Check if locale equals the requested page locale #}
      {% if locale == craft.locale %}
          {% set current = true %}
      {% else %}
          {% set current = false %}
      {% endif %}
      {% set locale = craft.i18n.getCurrentLocale() %}
        {% for locale in locales %}
           &lt;li&gt;
             &lt;a href="{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}" class="{{ current ? 'uk-active'}}"&gt;{{ craft.i18n.getLocaleById(locale).name }}&lt;/a&gt;&lt;/li&gt;     
  </code></pre>
  
  <p>When I try to copy </p>
  
  <pre><code>&lt;a href="{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}" 
  class="{{ current ? 'uk-active'}}"&gt;{{ craft.i18n.getLocaleById(locale).name }}&lt;/a&gt;
  </code></pre>
  
  <p>and put it to my navigation menu I get </p>
  
  <pre><code>Internal Server Error    array_key_exists(): The first argument should be either a string or an integer
  </code></pre>
  
  <p>Is it fixable or any other way around?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-21T17:30:47.370Z
Comments.Text: Does `locale` in line 3 have a value? Code looks like there's missing pieces. See [this question](http://craftcms.stackexchange.com/q/877/125) for a working Language switch solution I use.
Comments.UserDisplayName: carlcs
Tags: <localization>
Title: Get local's URL for index page
ThreadText: # Get local's URL for index page
  
  (Asked by: username_0 on 2015-02-21)
  
  I have two menus.
  One with countries, one with navigation.
  
  Navigation menu must to have a index link of a active locale.
  So if I'm at example.com/uk/section and I go to navigation menu and click at index link, I get index of /uk
  
  My countries menu code is:
  
  ```
  {% set locales = ['en', 'en_gb', 'sk'] %}
      {# Check if locale equals the requested page locale #}
      {% if locale == craft.locale %}
          {% set current = true %}
      {% else %}
          {% set current = false %}
      {% endif %}
      {% set locale = craft.i18n.getCurrentLocale() %}
        {% for locale in locales %}
           <li>
             <a href="{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}" class="{{ current ? 'uk-active'}}">{{ craft.i18n.getLocaleById(locale).name }}</a></li>     
  
  ```
  
  When I try to copy
  
  ```
  <a href="{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}" 
  class="{{ current ? 'uk-active'}}">{{ craft.i18n.getLocaleById(locale).name }}</a>
  
  ```
  
  and put it to my navigation menu I get
  
  ```
  Internal Server Error    array_key_exists(): The first argument should be either a string or an integer
  
  ```
  
  Is it fixable or any other way around?
  
  **Tags:** localization
  
  > **Comments:**
  > **username_1**: Does `locale` in line 3 have a value? Code looks like there's missing pieces. See [this question](http://craftcms.stackexchange.com/q/877/125) for a working Language switch solution I use.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-02-21. Score: 3 | Accepted answer
  
  I probably don't fully understand what you're trying to acchieve, but to get to the index page of your current locale, you'd simply use `siteUrl()`.
  
  
  ---
  
  ### Answer by username_2 on 2015-02-21. Score: 2
  
  When calling this:
  
  ```
   {% set locale = craft.i18n.getCurrentLocale() %}
  
  ```
  
  `locale` is set to a full blown [LocaleModel](http://buildwithcraft.com/classreference/models/LocaleModel) object.
  
  What you're probably looking for is its [getId()](http://buildwithcraft.com/classreference/models/LocaleModel#getId-detail) method.
  
  ```
  craft.config.siteUrl[locale->getId()]
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks username_2 for your respond and time. To get a index link of a locale was simply to use `siteUrl()`.  
  
  ---
  
  