Translation support and minor login view changes #35

Open
rskthomas wants to merge 20 commits from feature/translation into main
4 changed files with 16 additions and 16 deletions
Showing only changes of commit 2a6396b185 - Show all commits

View file

@ -17,7 +17,7 @@
<thead> <thead>
<tr> <tr>
<th scope="col">Email</th> <th scope="col">Email</th>
<th>is Admin</th> <th>{% trans "admin?" %}</th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>

View file

@ -183,7 +183,7 @@
<form method="post" action="{% url 'dashboard:search' %}"> <form method="post" action="{% url 'dashboard:search' %}">
{% csrf_token %} {% csrf_token %}
<div class="input-group rounded"> <div class="input-group rounded">
<input type="search" name="search" class="form-control rounded" placeholder="Search your device..." aria-label="Search" aria-describedby="search-addon" /> <input type="search" name="search" class="form-control rounded" placeholder="{% trans 'Search your device' %}" aria-label="Search" aria-describedby="search-addon" />
<span class="input-group-text border-0" id="search-addon"> <span class="input-group-text border-0" id="search-addon">
<i class="fas fa-search"></i> <i class="fas fa-search"></i>
</span> </span>
@ -214,7 +214,7 @@
<div class="dropdown ms-auto"> <div class="dropdown ms-auto">
<form action="{% url 'set_language' %}" method="post"> <form action="{% url 'set_language' %}" method="post">
{% csrf_token %} {% csrf_token %}
<button class="btn btn-secondary dropdown-toggle" type="button" id="languageDropdown" data-bs-toggle="dropdown" aria-expanded="false"> <button class="btn btn-tertiary dropdown-toggle" type="button" id="languageDropdown" data-bs-toggle="dropdown" aria-expanded="false">
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
{% get_language_info_list for LANGUAGES as languages %} {% get_language_info_list for LANGUAGES as languages %}
{{ LANGUAGE_CODE|get_language_code:languages }} {{ LANGUAGE_CODE|get_language_code:languages }}

View file

@ -35,19 +35,19 @@
<thead> <thead>
<tr> <tr>
<th scope="col" data-sortable=""> <th scope="col" data-sortable="">
select {%trans "select"%}
</th> </th>
<th scope="col" data-sortable=""> <th scope="col" data-sortable="">
shortid {%trans "shortid" %}
</th> </th>
<th scope="col" data-sortable=""> <th scope="col" data-sortable="">
type {%trans "type" %}
</th> </th>
<th scope="col" data-sortable=""> <th scope="col" data-sortable="">
manufacturer {%trans "manufacturer" %}
</th> </th>
<th scope="col" data-sortable=""> <th scope="col" data-sortable="">
model {%trans "model" %}
</th> </th>
</tr> </tr>
</thead> </thead>
@ -75,7 +75,7 @@
</tbody> </tbody>
{% endfor %} {% endfor %}
</table> </table>
<button class="btn btn-green-admin" type="submit" value="{% url 'lot:del_devices' %}" name="url">Remove</button> <button class="btn btn-green-admin" type="submit" name="url" value="{% url 'lot:add_devices' %}">add</button> <button class="btn btn-green-admin" type="submit" value="{% url 'lot:del_devices' %}" name="url">{% trans 'Remove' %}</button> <button class="btn btn-green-admin" type="submit" name="url" value="{% url 'lot:add_devices' %}">{% trans 'Add'%}</button>
</form> </form>
</div> </div>
<div class="row mt-3"> <div class="row mt-3">

View file

@ -1,8 +1,8 @@
from django import forms from django import forms
from utils.device import create_annotation, create_doc, create_index from utils.device import create_annotation, create_doc, create_index
from utils.save_snapshots import move_json, save_in_disk from utils.save_snapshots import move_json, save_in_disk
from django.utils.translation import gettext_lazy as _
#TODO: translate device types
DEVICE_TYPES = [ DEVICE_TYPES = [
("Desktop", "Desktop"), ("Desktop", "Desktop"),
("Laptop", "Laptop"), ("Laptop", "Laptop"),
@ -22,11 +22,11 @@ DEVICE_TYPES = [
class DeviceForm(forms.Form): class DeviceForm(forms.Form):
type = forms.ChoiceField(choices = DEVICE_TYPES, required=False) type = forms.ChoiceField(choices = DEVICE_TYPES, required=False, label= _(u"Type"))
amount = forms.IntegerField(required=False, initial=1) amount = forms.IntegerField(required=False, initial=1, label= _(u"Amount"))
custom_id = forms.CharField(required=False) custom_id = forms.CharField(required=False, label=_(u"Custom id"))
name = forms.CharField(required=False) name = forms.CharField(required=False, label= _(u"Name"))
value = forms.CharField(required=False) value = forms.CharField(required=False, label=_(u"Value"))
class BaseDeviceFormSet(forms.BaseFormSet): class BaseDeviceFormSet(forms.BaseFormSet):