{% load i18n %}
{% get_language_info_list for LANGUAGES as languages %}
{% if settings.USE_MODELTRANSLATION and languages|length > 1 %}
{# hide submit button if browser has javascript support and can react to onchange event #}
<script>$(document).ready(function(){$('#language_selector_form').change(function(){this.submit();});$('#language_selector_form input').hide();});</script>
<div>
<form action="{% url "set_language" %}" method="post" id="language_selector_form">
  {% csrf_token %}
  <div class="form-group">
    <select name="language" class="form-control">
      {% for language in languages %}
      <option value="{{ language.code }}"
      {% if language.code == LANGUAGE_CODE %}selected="selected"{% endif %}>
      {{ language.name_local }}
      </option>
      {% endfor %}
    </select>
  </div>
  <input type="submit" class="btn btn-default" value="{% trans "Change" %}" />
</form>
</div>
{% endif %}
