1

We need to part translate a site, and by which i mean only certain sections are available in other locales, and only certain Entries in those pages. In order to display these in the front end we simply want to show :

"This entry is also available in French"

at the base of the entry, and link to a special layout (no nav).

Has anyone achieved this - can the locales be called for each entry ?

Thanks Dan

1 Answer 1

1

I think the best way to do this, is by using craft.entries.id().locale() and checking if any entries are returned (not tested):

{% set thisEntryInDifferentLocales = craft.entries.id(thisEntry.id).locale('fr') %}
{% if thisEntryInDifferentLocales | length %}
    {% for localeEntry in thisEntryInDifferentLocales %}
       <a href="{{ localeEntry.url }}">This entry is also available in {{ localeEntry.locale }}</a>
    {% endfor %}
{% endif %}
2
  • Thanks Paul - great response. Returned an array error in testing. Do you think we need to declare the locales in the first line or can it check for the locales available (live) for that entry?
    – Dan G
    Commented Oct 1, 2014 at 9:23
  • Maybe locales can not be requested in an array, but only per locale. I'll edit my response, try again.
    – Paul
    Commented Oct 1, 2014 at 9:25

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.