{# Only output the widget if the contenttype is translatable. So, it must have a 'locale' field. #} {% if app.config.get('contenttypes/'~ app.request.get('contenttypeslug') ~ "/fields/locale") %}
Multilingual content
{% set currentkey = locales|keys|first %} {% set current = locales|first %} {% for key, option in locales %} {% set current = option.get('slug') == app['translate.slug'] ? option : current %} {% set currentkey = option.get('slug') == app['translate.slug'] ? key : currentkey %} {% endfor %}

Currently selected: {{ flag_icon(currentkey) }} {{ current.get('label') }} ({{ current.get('slug') }})

{% endif %}