{% import "partials/language.html" as lang with context %}
{% if config.extra.languages and config.extra.languages | length > 1 %}
  {% set languages_list = config.extra.languages %}
  {% set current_language = config.theme.language %}
  <div class="md-header__option"></form>
    <div class="md-select">
      {% set icon = config.theme.icon.alternate or "material/translate" %}
      <button
        class="md-header__button md-icon"
        aria-label="{{ lang.t('select.language.title') }}"
      >
        {% include ".icons/" ~ icon ~ ".svg" %}
      </button>
      <div class="md-select__inner">
        <ul class="md-select__list">
          {% if current_language in languages_list %}
            <li class="md-select__item md-selected_language_item">
              <a
                href="{{ config.site_url + current_language }}"
                hreflang="{{ config.site_url + current_language }}"
                class="md-select__link"
              >
                {{languages_list[current_language] | e }}
              </a>
            </li>
          {% endif %}
          {% for lang_code, lang_name in languages_list.items() %}
            {% if lang_code != current_language %}
              <li class="md-select__item">
                <a
                  href="{{ config.site_url + lang_code }}"
                  hreflang="{{ config.site_url + lang_code }}"
                  class="md-select__link"
                >
                  {{ lang_name | e }}
                </a>
              </li>
            {% endif %}
          {% endfor %}
        </ul>
      </div>
    </div>
  </div>
{% endif %}
