8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Mark strings for translation in tickets

This commit is contained in:
Laouen Fernet 2019-11-20 00:49:36 +00:00 committed by chirac
parent fe4de10f7a
commit 6522051728
13 changed files with 54 additions and 50 deletions

View file

@ -25,30 +25,30 @@ class Ticket(AclMixin, models.Model):
null=True, null=True,
) )
title = models.CharField( title = models.CharField(
max_length=255, help_text=_("Title of the ticket"), blank=False, null=False max_length=255, help_text=_("Title of the ticket."), blank=False, null=False
) )
description = models.TextField( description = models.TextField(
max_length=3000, max_length=3000,
help_text=_("Description of the ticket"), help_text=_("Description of the ticket."),
blank=False, blank=False,
null=False, null=False,
) )
date = models.DateTimeField(auto_now_add=True) date = models.DateTimeField(auto_now_add=True)
email = models.EmailField( email = models.EmailField(
help_text=_("An email address to get back to you"), max_length=100, null=True help_text=_("An email address to get back to you."), max_length=100, null=True
) )
solved = models.BooleanField(default=False) solved = models.BooleanField(default=False)
class Meta: class Meta:
permissions = (("view_tickets", _("Can view a ticket object")),) permissions = (("view_tickets", _("Can view a ticket object")),)
verbose_name = _("Ticket") verbose_name = _("ticket")
verbose_name_plural = _("Tickets") verbose_name_plural = _("tickets")
def __str__(self): def __str__(self):
if self.user: if self.user:
return "Ticket from {}. Date: {}".format(self.user.surname, self.date) return _("Ticket from %(name)s. Date: %(date)s.").format(name=self.user.surname, date=self.date)
else: else:
return "Anonymous Ticket. Date: {}".format(self.date) return _("Anonymous ticket. Date: %s.") % (self.date)
def publish_mail(self): def publish_mail(self):
site_url = GeneralOption.objects.first().main_site_url site_url = GeneralOption.objects.first().main_site_url
@ -57,7 +57,7 @@ class Ticket(AclMixin, models.Model):
lang = Preferences.objects.first().mail_language lang = Preferences.objects.first().mail_language
if lang == 0: if lang == 0:
obj = "Nouvelle ouverture de ticket" obj = "Nouveau ticket ouvert"
template = loader.get_template("tickets/publication_mail_fr") template = loader.get_template("tickets/publication_mail_fr")
else: else:
obj = "New ticket opened" obj = "New ticket opened"

View file

@ -7,15 +7,15 @@ class Preferences(models.Model):
publish_address = models.EmailField( publish_address = models.EmailField(
help_text=_( help_text=_(
"Email address to publish the new tickets (leave empty for no publications)" "Email address to publish the new tickets (leave empty for no publication)."
), ),
max_length=1000, max_length=1000,
null=True, null=True,
) )
LANG_FR = 0 LANG_FR = 0
LANG_EN = 1 LANG_EN = 1
LANGUES = ((0, _("Français")), (1, _("English"))) LANGUES = ((0, _("French")), (1, _("English")))
mail_language = models.IntegerField(choices=LANGUES, default=LANG_FR) mail_language = models.IntegerField(choices=LANGUES, default=LANG_FR)
class Meta: class Meta:
verbose_name = _("Ticket's settings") verbose_name = _("tickets preferences")

View file

@ -31,11 +31,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block content %} {% block content %}
<h2> Ticket #{{ticket.id}} <h2>{% blocktrans with id=ticket.id %}Ticket #{{id}}{% endblocktrans %}
{% if ticket.solved %} {% if ticket.solved %}
<span class="badge badge-success">{% trans "Solved" %}</span> <span class="badge badge-success">{% trans "Solved" %}</span>
{% else %} {% else %}
<span class="badge badge-danger">{% trans "Not Solved" %}</span> <span class="badge badge-danger">{% trans "Not solved" %}</span>
{% endif %} {% endif %}
</h2> </h2>
@ -47,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ ticket.user.get_full_name }} {{ ticket.user.get_full_name }}
</a> </a>
{% else %} {% else %}
{% trans "Anonymous User" %} {% trans "Anonymous user" %}
{% endif %} {% endif %}
{{ ticket.date | naturalday}}. {{ ticket.date | naturalday}}.
{% if not ticket.user %} {% if not ticket.user %}
@ -57,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel-body"> <div class="panel-body">
<p><b>{% trans "Title:" %}</b> {{ticket.title}}</p> <p><b>{% trans "Title:" %}</b> {{ticket.title}}</p>
<p><b>{% trans "Description" %}</b> {{ ticket.description }}</p> <p><b>{% trans "Description:" %}</b> {{ ticket.description }}</p>
<div class="text-right"> <div class="text-right">
<form class="form" method="post"> <form class="form" method="post">
@ -65,9 +65,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% bootstrap_form changestatusform %} {% bootstrap_form changestatusform %}
{% if not ticket.solved %} {% if not ticket.solved %}
{% bootstrap_button "Mark as Solved" button_type="submit" button_class='btn-info' %} {% trans "Mark as solved" as tr_mark_solved %}
{% bootstrap_button tr_mark_solved button_type="submit" button_class='btn-info' %}
{% else %} {% else %}
{% bootstrap_button "Mark as not Solved" button_type="submit" button_class='btn-warning' %} {% trans "Mark as not solved" as tr_mark_not_solved %}
{% bootstrap_button tr_mark_not_solved button_type="submit" button_class='btn-warning' %}
{% endif %} {% endif %}
</form> </form>
</div> </div>
@ -76,7 +78,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="text-right"> <div class="text-right">
<a type="button" href="{% url 'tickets:aff-tickets' %}" class="btn btn-primary"><p>{% trans "Tous les tickets" %}</p></a> <a type="button" href="{% url 'tickets:aff-tickets' %}" class="btn btn-primary"><p>{% trans "All tickets" %}</p></a>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -32,13 +32,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<hr class="col-sm-12"> <hr class="col-sm-12">
<div class="row justify-content-start"> <div class="row justify-content-start">
<div class="col-sm-4"> <div class="col-sm-4">
<span class="badge badge-light">{{ nbr_tickets }}</span> {% trans "Tickets" %} <span class="badge badge-light">{{ nbr_tickets }}</span> {% blocktrans count nb=nbr_tickets %}Ticket{% plural %}Tickets{% endblocktrans %}
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<span class="badge badge-light"> {{ nbr_tickets_unsolved }}</span>{% trans "Not Solved Tickets" %} <span class="badge badge-light"> {{ nbr_tickets_unsolved }}</span> {% blocktrans count nb=nbr_tickets_unsolved %}Ticket not solved{% plural %}Tickets not solved{% endblocktrans %}
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<span>{% trans "Last Ticket:" %} {{ last_ticket_date }}</span> <span>{% trans "Last ticket:" %} {{ last_ticket_date }}</span>
</div> </div>
</div> </div>
<hr class="col-sm-12"> <hr class="col-sm-12">
@ -52,10 +52,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<thead> <thead>
<tr> <tr>
<th scope="col"></th> <th scope="col"></th>
<th scope="col">User</th> <th scope="col">{% trans "User" %}</th>
<th scope="col">Titre</th> <th scope="col">{% trans "Title" %}</th>
<th scope="col">Date</th> <th scope="col">{% trans "Date" %}</th>
<th scope="col">Résolu</th> <th scope="col">{% trans "Solved" %}</th>
</tr> </tr>
{% for ticket in tickets_list %} {% for ticket in tickets_list %}
<tr> <tr>
@ -67,7 +67,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% if ticket.user %} {% if ticket.user %}
<td><a href="{% url 'users:profil' ticket.user.id%}" role="button">{{ ticket.user.get_short_name }}</a></td> <td><a href="{% url 'users:profil' ticket.user.id%}" role="button">{{ ticket.user.get_short_name }}</a></td>
{% else %} {% else %}
<td> Anonyme </td> <td>{% trans "Anonymous" %}</td>
{% endif %} {% endif %}
<td>{{ ticket.title }}</td> <td>{{ ticket.title }}</td>
<td>{{ ticket.date }}</td> <td>{{ ticket.date }}</td>

View file

@ -1,13 +1,13 @@
{% load i18n %} {% load i18n %}
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"><h4>Tickets</h4></div> <div class="panel-heading"><h4>{% trans "Tickets" %}</h4></div>
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-sm-9"> <div class="col-sm-9">
{% blocktrans %}If you are experiencing issues with the services offered by {{asso_name}}, you can open a ticket that will be taken care of. If you want to contact us on any other topic, please choose one address below.{% endblocktrans %} {% blocktrans %}If you are experiencing issues with the services offered by {{asso_name}}, you can open a ticket that will be taken care of. If you want to contact us on any other topic, please choose one address below.{% endblocktrans %}
</div> </div>
<div class="col-sm-3"><a class="btn btn-primary" href="{% url 'tickets:new-ticket' %}"><i class="fa fa-ticket"></i> {% trans "Ouvrir un ticket" %}</a></div> <div class="col-sm-3"><a class="btn btn-primary" href="{% url 'tickets:new-ticket' %}"><i class="fa fa-ticket"></i> {% trans "Open a ticket" %}</a></div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Ticket" %}{% endblock %} {% block title %}{% trans "Ticket" %}{% endblock %}
{% block content %} {% block content %}
<h2> {% trans "Tickets settings modification" %}</h2> <h2> {% trans "Editing of tickets preferences" %}</h2>
{% for message in messages %} {% for message in messages %}
<div class="{{ message| bootstrap_message_classes }} alert-dismissable"> <div class="{{ message| bootstrap_message_classes }} alert-dismissable">
@ -43,6 +43,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% csrf_token %} {% csrf_token %}
{% bootstrap_field preferencesform.publish_address %} {% bootstrap_field preferencesform.publish_address %}
{% bootstrap_field preferencesform.mail_language %} {% bootstrap_field preferencesform.mail_language %}
{% bootstrap_button "Editer" button_type="submit" icon='ok' button_class='btn-success' %} {% trans "Edit" as tr_edit %}
{% bootstrap_button tr_edit button_type="submit" icon='ok' button_class='btn-success' %}
</form> </form>
{% endblock %} {% endblock %}

View file

@ -1,4 +1,4 @@
{% extends 'machines/sidebar.html' %} {% extends 'users/sidebar.html' %}
{% comment %} {% comment %}
Re2o est un logiciel d'administration développé initiallement au rezometz. Il Re2o est un logiciel d'administration développé initiallement au rezometz. Il
se veut agnostique au réseau considéré, de manière à être installable en se veut agnostique au réseau considéré, de manière à être installable en
@ -31,28 +31,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Ticket" %}{% endblock %} {% block title %}{% trans "Ticket" %}{% endblock %}
{% block content %} {% block content %}
<h2> Ouverture d'un Ticket </h2> <h2>{% trans "Ticket opening" %}</h2>
<form class="form" method="post"> <form class="form" method="post">
{% csrf_token %} {% csrf_token %}
{% if not user.is_authenticated %} {% if not user.is_authenticated %}
<p>{% trans "Vous n'êtes pas authentifié. Veuillez fournir une adresse mail afin que nous puissions vous recontacter." %}</p> <p>{% trans "You are not authenticated. Please log in or provide an email address so we can get back to you." %}</p>
{% bootstrap_field ticketform.email %} {% bootstrap_field ticketform.email %}
{% endif %} {% endif %}
{% bootstrap_field ticketform.title %} {% bootstrap_field ticketform.title %}
<br> <br>
<p>{% trans "Description de votre problème. Veuillez fournir le plus d'informations possible afin de faciliter la recherche de solution. Voici quelques informations dont nous pourions avoir besoin:" %}</p> <p>{% trans "Description of your problem. Please give as much information as possible to help us searching for a solution. Here is some information we might need:" %}</p>
<ul class="list"> <ul class="list">
<li> <li>
<p> {% trans "Le type de votre problème (adhesion, connexion, paiement ou autre)." %}</p> <p> {% trans "The type of your problem (membership, connection, payment etc.)." %}</p>
</li> </li>
<li> <li>
<p> {% trans "Les conditions dans lesquelles vous rencontrez le problème (Wifi/filaire, sur tout les apareils ou sur un seul. Est-ce une nouvelle machine ?" %}</p> <p> {% trans "The conditions in which you encounter the problem (Wi-Fi/wired connection, on every machines or only one, on a new machine etc.)." %}</p>
</li> </li>
<li> <li>
<p> {% trans "Les endroits dans lequels le problème survient (chez vous, dans une partie commune, dans un batiment en particulier)." %}</p> <p> {% trans "The locations where you encounter the problem (in your room, in a common space, in a specific building etc.)." %}</p>
</ul> </ul>
{% bootstrap_field ticketform.description %} {% bootstrap_field ticketform.description %}
{% bootstrap_button "Ouvrir le Ticket" button_type="submit" icon='ok' button_class='btn-success' %} {% trans "Open the ticket" as tr_open %}
{% bootstrap_button tr_open button_type="submit" icon='ok' button_class='btn-success' %}
</form> </form>
{% endblock %} {% endblock %}

View file

@ -29,6 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title%}{% trans "Tickets" %}{% endblock %} {% block title%}{% trans "Tickets" %}{% endblock %}
{% block content %} {% block content %}
<h2>{% trans "Tickets" %}</h2> <h2>{% trans "List of tickets" %}</h2>
{% include 'tickets/aff_tickets.html' with tickets_list=tickets_list %} {% include 'tickets/aff_tickets.html' with tickets_list=tickets_list %}
{% endblock %} {% endblock %}

View file

@ -1,2 +1,2 @@
{% load i18n %} {% load i18n %}
<li><a href="{% url 'tickets:aff-tickets' %}"><i class="fa fa-ticket"></i> {% trans "Tickets" %}</a></li> <li><a href="{% url 'tickets:aff-tickets' %}"><i class="fa fa-ticket"></i> {% trans "Manage the tickets" %}</a></li>

View file

@ -1,6 +1,6 @@
{% load i18n %} {% load i18n %}
<li> <li>
<a href="{% url 'tickets:new-ticket' %}"> <a href="{% url 'tickets:new-ticket' %}">
<i class="fa fa-ticket"></i> {% trans "Ouvrir un ticket" %} <i class="fa fa-ticket"></i> {% trans "Open a ticket" %}
</a> </a>
</li> </li>

View file

@ -22,7 +22,7 @@
{% if preferences.publish_address %} {% if preferences.publish_address %}
<td><p>{{ preferences.publish_address }}</p></td> <td><p>{{ preferences.publish_address }}</p></td>
{% else %} {% else %}
<td><p>{% trans "Pas d'adresse, les tickets ne sont pas annoncés" %}</p></td> <td><p>{% trans "No email address, the tickets will not be published." %}</p></td>
{% endif %} {% endif %}
</tr> </tr>
<tr> <tr>

View file

@ -9,7 +9,7 @@
<div id="ticket" class="panel-collapse collapse"> <div id="ticket" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'tickets:new-ticket' %}"> <a class="btn btn-primary btn-sm" role="button" href="{% url 'tickets:new-ticket' %}">
<i class="fa fa-ticket"></i>{% trans " Open a Ticket" %} <i class="fa fa-ticket"></i> {% trans "Open a ticket" %}
</a> </a>
</div> </div>
<div class="panel-body"> <div class="panel-body">

View file

@ -66,7 +66,7 @@ def new_ticket(request):
messages.success( messages.success(
request, request,
_( _(
"Your ticket has been succesfully open. We will take care of it as soon as possible." "Your ticket has been succesfully opened. We will take care of it as soon as possible."
), ),
) )
return redirect( return redirect(
@ -77,7 +77,7 @@ def new_ticket(request):
messages.success( messages.success(
request, request,
_( _(
"Your ticket has been succesfully open. We will take care of it as soon as possible." "Your ticket has been succesfully opened. We will take care of it as soon as possible."
), ),
) )
return redirect(reverse("index")) return redirect(reverse("index"))
@ -149,10 +149,10 @@ def edit_preferences(request):
if preferencesform.is_valid(): if preferencesform.is_valid():
if preferencesform.changed_data: if preferencesform.changed_data:
preferencesform.save() preferencesform.save()
messages.success(request, "Préférences des Tickets mises à jour") messages.success(request, _("The tickets preferences were edited."))
return redirect(reverse("preferences:display-options")) return redirect(reverse("preferences:display-options"))
else: else:
messages.error(request, "Formulaire Invalide") messages.error(request, _("Invalid form."))
return form( return form(
{"preferencesform": preferencesform}, {"preferencesform": preferencesform},
"tickets/form_preferences.html", "tickets/form_preferences.html",