{% load i18n languages_helpers %}

<div id="language-switcher" class="nav-link">
    <form action="{% url 'set_language' %}" method="post">
        {% csrf_token %}
        <input name="next" type="hidden" value="{{ redirect_to }}" />
        <select name="language" onchange="this.form.submit()" aria-label="Language">
            {% for language in request|get_language_info_list_ex %}
            <li class="nav-item">
                <option value="{{ language.code }}" {% if language.is_current %} selected="selected"{% endif %}>
                    <span class="flag">{{ language.flag }}</span>
                    {# {{ language.code }} #}
                </option>
            </li>
            {% endfor %}
        </select>
    </form>
</div>
