Refactor language selection

This commit is contained in:
Oliver 2021-07-27 00:58:31 +10:00
parent b7b0574a44
commit 3349e9ff6c
3 changed files with 31 additions and 1 deletions

View File

@ -37,6 +37,10 @@
</div>
</div>
<div class='panel-heading'>
<h4>{% trans "Language Settings" %}</h4>
</div>
<div class="row">
<form action="{% url 'set_language' %}" method="post">{% csrf_token %}
<input name="next" type="hidden" value="{% url 'settings-appearance' %}">

View File

@ -15,7 +15,6 @@
{% block content %}
{% include "InvenTree/settings/user.html" %}
{% include "InvenTree/settings/appearance.html" %}
{% include "InvenTree/settings/user_settings.html" %}
{% if user.is_staff %}

View File

@ -1,6 +1,7 @@
{% extends "panel.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block label %}account{% endblock %}
@ -36,4 +37,30 @@
<td>{{ user.email }}</td>
</tr>
</table>
<div class='panel-heading'>
<h4>{% trans "Language Settings" %}</h4>
</div>
<div class="row">
<form action="{% url 'set_language' %}" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="{% url 'settings' %}">
<div class="col-sm-6" style="width: 200px;"><div id="div_id_name" class="form-group"><div class="controls ">
<select name="language" class="select form-control">
{% 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{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
</div></div></div>
<div class="col-sm-6" style="width: auto;">
<input type="submit" value="{% trans 'Set Language' %}" class="btn btn btn-primary">
</div>
</form>
</div>
{% endblock %}