{% load i18n menu_tags cms_tags %}{% spaceless %}

{% if languages|length > 1 %}
  {% get_current_language as current_language_code %}
  <ul class="topbar__menu__list topbar__menu__list--aside">
    {% for code, name in languages %}
      {% get_language_info for code as lang %}
      {% if code == current_language_code %}
        <li class="topbar__menu__list__item topbar__menu__list__item--language topbar__menu__list__item--{{ code }} topbar__menu__list__item--active">
          <a class="topbar__menu__list__item__link" href="{% page_language_url code %}"
             title="{% blocktrans with code=lang.code|slice:":2" name=lang.name_translated %}{{ code }}, currently in {{ name }}{% endblocktrans %}">
            {{ lang.code|slice:":2" }}
          </a>
        </li>
      {% else %}
        <li class="topbar__menu__list__item topbar__menu__list__item--language topbar__menu__list__item--{{ code }}">
          <a class="topbar__menu__list__item__link" href="{% page_language_url code %}"
             title="{% blocktrans with code=lang.code|slice:":2" name=lang.name_translated %}{{ code }}, switch to {{ name }}{% endblocktrans %}">
            {{ lang.code|slice:":2" }}
          </a>
        </li>
      {% endif %}
    {% endfor %}
  </ul>
{% endif %}
{% endspaceless %}
