locale loop doesn't get correct path I'm trying to loop on locales to get the path to the current entry, but for the other locales (for a language switcher).

Here is my code:

{% set locales = craft.i18n.getSiteLocales() %}
{% for locale in locales %}

    {% set localeEntry = craft.entries.id(entry.id).locale(locale.id).first %}

        {{dump(localeEntry.locale)}}
        {{dump(localeEntry.getUrl()) }}

{% endfor %}


Results:

"en"
"http://website.dev/en/page"

"en_gb"
"http://website.dev/en/page"

"en_us"
"http://website.dev/en/page"

"de"
"http://website.dev/de/page"


The language only versions are fine en and de, though the language-location versions are incorrect. These are all set correctly in my config.

What am I doing wrong here?
Turns out the issue was my config set incorrectly. I was doing this:

'siteUrl' =&gt; array(
    'en' =&gt; 'http://website.dev/en',
    'en-gb' =&gt; 'http://website.dev/en-gb',
    'en-us' =&gt; 'http://website.dev/en-us',
    'en-au' =&gt; 'http://website.dev/en-au',
    'en-nz' =&gt; 'http://website.dev/en-nz'
),


When the array keys need to match the way they are set in craft with underscores (and your public/locale/index.php file)

'siteUrl' =&gt; array(
    'en' =&gt; 'http://website.dev/en',
    'en_gb' =&gt; 'http://website.dev/en-gb',
    'en_us' =&gt; 'http://website.dev/en-us',
    'en_au' =&gt; 'http://website.dev/en-au',
    'en_nz' =&gt; 'http://website.dev/en-nz'
),