I have just one page on my site with only one language:

enter image description here

Every other page has two languages.

I want to disable certain things on that page (like language switchers). How do I determine this?

This just returns all avalable languages no matter what languages are activated:

{% set otherLocales = craft.i18n.getSiteLocaleIds() %}
  {% for locale in otherLocales %}
    {{ locale }}
  {% endfor %}

I tried to do it with status:

{% set otherLocales = craft.i18n.getSiteLocaleIds().status('live') %}

but that returns an error as well. I tried status because it's labeled that way in the cp.

This returns the opposite language although the other locale doesn't exist on this page.

{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %}
{% for locale in otherLocales %}
  {{ locale }}
{% endfor %}

Any other ideas?


You can query for the same entry in another locale by explicitly setting the locale parameter.

{% set de = craft.entries.id(entry.id).locale('de').first() %}
{% set en = craft.entries.id(entry.id).locale('en').first() %}

German:  {{ de ? 'OK' : 'nope' }}
English: {{ en ? 'OK' : 'nope' }}

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.