In continuation of https://statamic.com/forum/2525-localize-theme-partials I'm stuck creating a language switcher. I know the answer has to be quite easy, as I am yet to learn the tags of Statamic and the explanation of locales on https://docs.statamic.com/tags/locales is too compact for me now. This is what I like to see in my nav: when viewing Dutch show me the View in English button, and when viewing English show me the View in Dutch button. This is my code:

{{ locales }}
    {{ if locale == 'nl' }}
        <li><a href="{{ url }}">{{ locale:en }}</a></li>
    {{ else }}
        <li><a href="{{ url }}">{{ locale:nl }}</a></li>
    {{ /if }}
 {{ /locales }}

which results in showing always both buttons, no matter which language is being viewed.

Can anyone put me in the right direction?

Answered by Peter Rainer! Go to answer.