For entries where the content isn't translated yet I'd like to add a "Sorry not translated yet" message.

Since all the content is synced is there a way to check if the synced content is the same as in the other locales?


You could try adding something like the following to the end of your template. This is assuming you only have 2 locales.

{# test for the current entry locale (i.e. spanish) #}
{% if entry.locale = 'es' %}

    {# retrieve the same entry in the original locale #}
    {% set localizedEntry = craft.entries.id(entry.id).locale('en') %}

    {# compare the body content, and append additional content #}
    {% if localizedEntry[0].body == entry.body %}
        Sorry, not translated yet.
    {% endif %}

{% endif %}
  • Cool. Could you explain what is exactly happening here? What does [0] do?
    – KSPR
    Oct 8 '14 at 9:16
  • 1
    craft.entries returns an ElementCriteriaModel that essentially acts like an array of entries, even if it only has 1 entry. [0] or .first returns the first item in the array. Oct 8 '14 at 9:22
  • 1
    In this case, you could also use: {% set localizedEntry = craft.entries.id(entry.id).locale('en').first %} and then wouldn't need the [0] in the if statement. Oct 8 '14 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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