3

in a multilingual site, how can i place multilingual links to content.

i.e. in the footer i would place a Imprint but in anohter language the slug might be /de/germanImprint...is there an easy helper to always get the right url from the english slug?

2
  • 1
    I probably misunderstood you totally on this one, but I tried anyways.
    – carlcs
    Commented Sep 4, 2014 at 15:20
  • nah i believe thats exactly what i needed, thx! :)
    – nexflo
    Commented Sep 8, 2014 at 9:06

1 Answer 1

3

This is how to "translate" a slug:

{% set enSlug = 'work' %}

{# Get the ID of an entry with that english slug #}
{% set enId = craft.entries.slug(enSlug).locale('en').first().id %}

{# Use the entry ID to get the german slug #}
{% set deSlug = craft.entries.id(enId).locale('de').first().slug %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.