I have two languages / locales: nl
and en
(nl
being Dutch, en
being English).
I also have an About-page, that has the slug about-us
in en
.
In nl
, the page's slug is over-ons
.
I have built a language switcher that looks like this:
<div class="i18n">
<!-- This page in Dutch -->
<li>
<a class="" href="{{ current_uri }}"></a>
</li>
<li>
<a class="" href="/en{{ current_uri }}"></a>
</li>
</div> <!-- .i18n -->
This works for pages that have the same slug in nl
and en
, but said About-page has a different slug in nl
and in en
.
The code above switches between https://<domain.ext>/over-ons
and https://<domain.ext>/en/over-ons
, while that last one should carry slug about-us
.
I've tried lots of things, but I can't figure out what to do:
{{ current_uri | locale == 'en' }}
{{ current_uri locale == 'en' }}
{{ current_url | locale == 'en' }}
{{ current_url locale == 'en' }}
{{ slug locale == 'en' }}
{{ slug | locale:en }}
etc. etc.
Hope anyone can point me in the right direction.