{% load i18n %}

<form class="dropdown-item" action="{% url 'set_language' %}" method="post">
    {% csrf_token %}

    <select class="form-select" onchange="this.form.submit()" id="lang-select" name="language">
        {% get_available_languages as LANGUAGES %}

        {% for lang_code, lang_name in LANGUAGES %}
            <option lang="{{ lang_code }}" value="{{ lang_code }}"{% if lang_code == LANGUAGE_CODE %} selected{% endif %}>
                {{ lang_code|language_name_local|capfirst }} ({{ lang_code }})
            </option>
        {% endfor %}
    </select>
</form>
