{% load i18n %}

<form class="px-3 py-2" action="{% url 'set_language' %}" method="post">
    {% csrf_token %}

    <select class="form-select form-select-sm" 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>
