{% load i18n %}

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

        <select class="form-select" onchange="this.form.submit()" class="form-control" 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>
</div>
