{% load i18n milea_tags %}

{% get_setting "milea_base.MULTILANGUAGE" as SHOW_LANG_SWITCHER %}

{% if SHOW_LANG_SWITCHER %}
    <div class="nav-item d-none d-md-flex me-3">
        <form action="{% url 'set_language' %}" method="post">
            {% csrf_token %}
            <select name="language" class="form-control" onchange="this.form.submit()">
                {% get_current_language as LANGUAGE_CODE %}
                {% get_available_languages as LANGUAGES %}
                {% get_language_info_list for LANGUAGES as languages %}
                {% for language in languages %}
                    <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>{{ language.name_local }} ({{ language.code }})</option>
                {% endfor %}
            </select>
        </form>
    </div>
{% endif %}
