Fix multilanguage

This commit is contained in:
2020-05-15 12:54:16 +02:00
parent 1c21979486
commit c1a8912f6d
24 changed files with 221 additions and 149 deletions

View File

@ -3,25 +3,28 @@
{% load static %}
{% load i18n %}
<!-- custom filter module -->
{% load i18n_switcher %}
{% block extrahead %}
<link rel="shortcut icon" href="{% static 'RUG_template/images/favicon.ico' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'RUG_template/css/custom_admin.css' %}"/>
{% endblock %}
{% block userlinks %}
{% comment %} Language choice. Should be put somewhere else when finale designs are done. {% endcomment %}
<form action="{% url 'set_language' %}" method="post" id="language_form" name="language_form">
{% csrf_token %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<a href="{{ request|switch_i18n:language.code}}">
{% with 'RUG_template/images/flag-'|add:language.code|add:'.png' as image_static %}
<img class="i18n_flag" src="{% static image_static %}" title="{% trans 'Language' %} {{ language.name_translated }}"/>
{% endwith %}
<input name="next" type="hidden" value="{% if redirect_to %}{{ redirect_to }}{% endif %}">
<input type="hidden" name="language" id="language" value="{{LANGUAGE_CODE}}">
{% for language in languages %}
<a onclick="document.getElementById('language').value='{{ language.code }}'; document.forms['language_form'].submit(); return false;" href="#">
{% with 'RUG_template/images/flag-'|add:language.code|add:'.png' as image_static %}
<img class="i18n_flag" src="{% static image_static %}" title="{% trans 'Language' %} {{ language.name_translated }}"/>
{% endwith %}
</a> /
{% endfor %}
{% endfor %}
</form>
{% if user.is_active and user.is_staff %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}