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?
en
, and noten_us
oren_gb
. If it is a country-specific code, then just change the code specified in your index.php file.return array('*' => array(), 'craft.dev' => array(...));