{% load i18n %}
{% load static spider_base %}

{% get_current_language as LANGUAGE_CODE %}
{% language "en" %}
<select onchange="if(this.value=='en'){window.location.href = '{% current_url %}'} else {window.location.href = `/${this.value}{% current_url %}`};return false;" {{attrs}}>
    {% get_available_languages as LANGUAGES %}
    {% get_language_info_list for LANGUAGES as languages %}
    {% for language in languages %}
        <option value="{{language.code}}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
            {{ language.name_local }} ({{ language.code }})
        </option>
    {% endfor %}
</select>
{% endlanguage %}
