{% load i18n %}

<div class="dropdown">
    <form action="{% url 'set_language' %}" method="post" style="margin-bottom: 15px;">
        {% csrf_token %}

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

            {% for language in languages %}
                <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>
                    {{ language.name_local }} ({{ language.code }})
                </option>
            {% endfor %}
        </select>
    </form>
</div>
