Answers.Body: <p>A multi-environment config needs to have a <code>*</code> key. This might work:</p>
  
  <pre><code>return array(
    '*' =&gt; array(),
    'craft.dev' =&gt; array(
      'siteUrl' =&gt; array(
        'de' =&gt; 'http://craft.dev/',
         en' =&gt; 'http://craft.dev/en/',
      ),
    ),
  );
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-10T23:26:22.130Z
Answers.LastActivityDate: 2015-03-10T23:26:22.130Z
Answers.UserDisplayName: Marion Newlevant
Answers.Body: <p>You may want to specify the <strong>locale</strong> of your nav links... <code>craft.locale</code> is the current locale.</p>
  
  <pre class="lang-html prettyprint-override"><code>{% set pages = craft.entries.section('pages').locale(craft.locale).level(1) %}
  &lt;nav&gt;
      &lt;ul&gt;
          {% for page in pages %}
              &lt;li&gt;{{ page.getLink() }}&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p>There are many different ways to create language links, several of which are <a href="https://craftcms.stackexchange.com/q/44/45">described in this thread...</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-10T11:15:22.897Z
Answers.Text: Thanks for your help. Unfortunately this isn`t working, too, when having a multi-environment config. Navigating to an english page, e.g. http://craft.dev/en/page-1, results in links like http://craft.dev/page-2, without the locale in it.  This behavior seems to depend on my config.
Answers.UserDisplayName: Patte
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-10T19:29:05.880Z
Answers.Text: Sounds like you may have hit a snag in [Step 4: Define your site URLs...](http://buildwithcraft.com/docs/localization-guide#step-4-define-your-site-uRLs)
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-10T07:29:40.463Z
Answers.LastActivityDate: 2015-03-10T07:29:40.463Z
Answers.LastEditDate: 2017-04-13T12:51:00.200Z
Answers.UserDisplayName: Lindsey D
Body: <p>I`ve got a multilingual site (DE/EN) with a Structures section (pages) and one Single for the homepage.</p>
  <p>In general.php I set up my localized site as described in the docs for a multi-environment config. German at the top level; English from en/ subfolder:</p>
  <pre><code>'domain.dev' =&gt; array(
      'siteUrl' =&gt; array(
          'de' =&gt; 'http://domain.dev/',
          'en' =&gt; 'http://domain.dev/en/',
      ),
  ),  
  </code></pre>
  <p>Within my public html folder I copied .htaccess and index.php to en/ and added define('CRAFT_LOCALE', 'en'); to index.php</p>
  <p>Navigating to <strong>domain.dev</strong> shows the german pages:</p>
  <ul>
  <li>Seite 1</li>
  <li>Seite 2</li>
  <li>Seite 3</li>
  </ul>
  <p>Changing the URL manually to <strong>domain.dev/en/</strong> shows their right translations</p>
  <ul>
  <li>Page 1</li>
  <li>Page 2</li>
  <li>Page 3</li>
  </ul>
  <p>and also their right links, e.g. <a href="http://domain.dev/en/page-1" rel="nofollow noreferrer">http://domain.dev/en/page-1</a></p>
  <p>BUT following the link to <strong>domain.dev/en/page-1</strong> the german content shows up again and the <strong>navigation switches back to german</strong>.</p>
  <pre><code>{% set pages = craft.entries.section('pages').level(1) %}
  &lt;nav&gt;
      &lt;ul&gt;
          {% for page in pages %}
              &lt;li&gt;{{ page.getLink() }}&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>
  <p>Going to any other english page (e.g. domain.dev/en/page-2) doesn't show up the english content (a translatable field) at all but neither the german content. So I think there is something wrong with my localization setup. Any ideas? Thanks much!</p>
  <hr />
  <h3>UPDATE</h3>
  <p>I set up a new craft installation and also a Localized Site as described in the docs.
  When defining the site URLs this way everything <strong>works like a charm</strong>:</p>
  <pre><code>return array(
      'siteUrl' =&gt; array(
          'de' =&gt; 'http://craft.dev/',
          'en' =&gt; 'http://craft.dev/en/',
      ),
  );
  </code></pre>
  <p>in combination with my <strong>multi-environment config</strong> it <strong>is not working</strong>.</p>
  <pre><code>return array(
      'craft.dev' =&gt; array(
          'siteUrl' =&gt; array(
              'de' =&gt; 'http://craft.dev/',
              'en' =&gt; 'http://craft.dev/en/',
          ),
      ),
  );
  </code></pre>
  <p>So I think my config is missing something to transmit the locale the right way?</p>
  <p>Is there another way to set up a localized site with multi-environment config?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-09T16:55:58.473Z
Comments.Text: When you setup your second locale, did you set it up as generic "English", or something more specific like "English - United States" or "English - Great Britain"? Make sure that your locale code is actually `en`, and not `en_us` or `en_gb`. If it _is_ a country-specific code, then just change the code specified in your index.php file.
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-09T17:03:01.413Z
Comments.Text: On a related note, yesterday I released a new [Language Link plugin](https://github.com/lindseydiloreto/craft-languagelink), designed to make switching between languages a much easier process.
Comments.UserDisplayName: Lindsey D
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-09T19:50:15.437Z
Comments.Text: I set it up as generic English (en) and double checked the index.php. With the Language Link Plugin I had the same problems.. so I really think it is a configuration thing.
Comments.UserDisplayName: Patte
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-10T17:31:36.700Z
Comments.Text: multi-environment config needs to have the _*_ key: `return array('*' => array(), 'craft.dev' => array(...));`
Comments.UserDisplayName: Marion Newlevant
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-10T19:35:56.217Z
Comments.Text: @MarionNewlevant You may want to submit that as a formal answer... I suspect that's the actual solution to the problem!
Comments.UserDisplayName: Lindsey D
Tags: <localization><navigation>
Title: Problems with Localized Site Navigation
ThreadText: # Problems with Localized Site Navigation
  
  (Asked by: username_0 on 2015-03-09)
  
  I`ve got a multilingual site (DE/EN) with a Structures section (pages) and one Single for the homepage.
  
  In general.php I set up my localized site as described in the docs for a multi-environment config. German at the top level; English from en/ subfolder:
  
  ```
  'domain.dev' => array(
      'siteUrl' => array(
          'de' => 'http://domain.dev/',
          'en' => 'http://domain.dev/en/',
      ),
  ),  
  
  ```
  
  Within my public html folder I copied .htaccess and index.php to en/ and added define('CRAFT\_LOCALE', 'en'); to index.php
  
  Navigating to **domain.dev** shows the german pages:
  
  * Seite 1
  * Seite 2
  * Seite 3
  
  Changing the URL manually to **domain.dev/en/** shows their right translations
  
  * Page 1
  * Page 2
  * Page 3
  
  and also their right links, e.g. <http://domain.dev/en/page-1>
  
  BUT following the link to **domain.dev/en/page-1** the german content shows up again and the **navigation switches back to german**.
  
  ```
  {% set pages = craft.entries.section('pages').level(1) %}
  <nav>
      <ul>
          {% for page in pages %}
              <li>{{ page.getLink() }}</li>
          {% endfor %}
      </ul>
  </nav>
  
  ```
  
  Going to any other english page (e.g. domain.dev/en/page-2) doesn't show up the english content (a translatable field) at all but neither the german content. So I think there is something wrong with my localization setup. Any ideas? Thanks much!
  
  ---
  
  ### UPDATE
  
  I set up a new craft installation and also a Localized Site as described in the docs.
  When defining the site URLs this way everything **works like a charm**:
  
  ```
  return array(
      'siteUrl' => array(
          'de' => 'http://craft.dev/',
          'en' => 'http://craft.dev/en/',
      ),
  );
  
  ```
  
  in combination with my **multi-environment config** it **is not working**.
  
  ```
  return array(
      'craft.dev' => array(
          'siteUrl' => array(
              'de' => 'http://craft.dev/',
              'en' => 'http://craft.dev/en/',
          ),
      ),
  );
  
  ```
  
  So I think my config is missing something to transmit the locale the right way?
  
  Is there another way to set up a localized site with multi-environment config?
  
  **Tags:** localization, navigation
  
  > **Comments:**
  > **username_1**: When you setup your second locale, did you set it up as generic "English", or something more specific like "English - United States" or "English - Great Britain"? Make sure that your locale code is actually `en`, and not `en_us` or `en_gb`. If it _is_ a country-specific code, then just change the code specified in your index.php file.  
  > **username_1**: On a related note, yesterday I released a new [Language Link plugin](https://github.com/lindseydiloreto/craft-languagelink), designed to make switching between languages a much easier process.  
  > **username_0**: I set it up as generic English (en) and double checked the index.php. With the Language Link Plugin I had the same problems.. so I really think it is a configuration thing.  
  > **username_2**: multi-environment config needs to have the _*_ key: `return array('*' => array(), 'craft.dev' => array(...));`  
  > **username_1**: @username_2 You may want to submit that as a formal answer... I suspect that's the actual solution to the problem!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-03-10. Score: 2 | Accepted answer
  
  A multi-environment config needs to have a `*` key. This might work:
  
  ```
  return array(
    '*' => array(),
    'craft.dev' => array(
      'siteUrl' => array(
        'de' => 'http://craft.dev/',
         en' => 'http://craft.dev/en/',
      ),
    ),
  );
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2015-03-10. Score: 1
  
  You may want to specify the **locale** of your nav links... `craft.locale` is the current locale.
  
  ```html
  {% set pages = craft.entries.section('pages').locale(craft.locale).level(1) %}
  <nav>
      <ul>
          {% for page in pages %}
              <li>{{ page.getLink() }}</li>
          {% endfor %}
      </ul>
  </nav>
  
  ```
  
  There are many different ways to create language links, several of which are [described in this thread...](https://craftcms.stackexchange.com/q/44/45)
  
  > **Comments:**
  > **username_0**: Thanks for your help. Unfortunately this isn`t working, too, when having a multi-environment config. Navigating to an english page, e.g. http://craft.dev/en/page-1, results in links like http://craft.dev/page-2, without the locale in it.  This behavior seems to depend on my config.  
  > **username_1**: Sounds like you may have hit a snag in [Step 4: Define your site URLs...](http://buildwithcraft.com/docs/localization-guide#step-4-define-your-site-uRLs)  
  
  ---
  
  