Skip to content

Instantly share code, notes, and snippets.

@yarickprih
Created August 16, 2020 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yarickprih/e271af0d95ad4ef96c1a3034937a94a8 to your computer and use it in GitHub Desktop.
Save yarickprih/e271af0d95ad4ef96c1a3034937a94a8 to your computer and use it in GitHub Desktop.
<form action="{% url 'set_language' %}" method="post" class="nav-link">
{% csrf_token %}
<input name="next" type="hidden" value="{{ redirect_to }}" />
<select name="language" style="width: auto; color: #d4c270"
onchange="this.form.submit()">
{% get_current_language as LANGUAGE_CODE %}
{% 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="selected" {% endif %}>
{{ language.code|upper }}
</option>
{% endfor %}
</select>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment