{% load i18n %}

<form action="{% url 'set_language' %}" method="post" data-bind="attr:{id: formid}">{% csrf_token %}
    <input name="next" type="hidden" value="{{ redirect_to }}">
    <select id="lang_dd" name="language" data-bind="value: value, chosen: {
        width:'100%'}">
        {% get_current_language as LANGUAGE_CODE %}
        {% get_available_languages as LANGUAGES %}
        {% for CODE, NAME in LANGUAGES %}
        <option value="{{ CODE|lower }}" {% if CODE|lower == LANGUAGE_CODE|lower %}selected="selected" {% endif %}>
            {{ NAME }} ({{ CODE }})
        </option>
        {% endfor %}
    </select>
</form>