8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +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,
)
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(
max_length=3000,
help_text=_("Description of the ticket"),
help_text=_("Description of the ticket."),
blank=False,
null=False,
)
date = models.DateTimeField(auto_now_add=True)
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)
class Meta:
permissions = (("view_tickets", _("Can view a ticket object")),)
verbose_name = _("Ticket")
verbose_name_plural = _("Tickets")
verbose_name = _("ticket")
verbose_name_plural = _("tickets")
def __str__(self):
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:
return "Anonymous Ticket. Date: {}".format(self.date)
return _("Anonymous ticket. Date: %s.") % (self.date)
def publish_mail(self):
site_url = GeneralOption.objects.first().main_site_url
@ -57,7 +57,7 @@ class Ticket(AclMixin, models.Model):
lang = Preferences.objects.first().mail_language
if lang == 0:
obj = "Nouvelle ouverture de ticket"
obj = "Nouveau ticket ouvert"
template = loader.get_template("tickets/publication_mail_fr")
else:
obj = "New ticket opened"

View file

@ -7,15 +7,15 @@ class Preferences(models.Model):
publish_address = models.EmailField(
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,
null=True,
)
LANG_FR = 0
LANG_EN = 1
LANGUES = ((0, _("Français")), (1, _("English")))
LANGUES = ((0, _("French")), (1, _("English")))
mail_language = models.IntegerField(choices=LANGUES, default=LANG_FR)
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 %}
<h2> Ticket #{{ticket.id}}
<h2>{% blocktrans with id=ticket.id %}Ticket #{{id}}{% endblocktrans %}
{% if ticket.solved %}
<span class="badge badge-success">{% trans "Solved" %}</span>
{% else %}
<span class="badge badge-danger">{% trans "Not Solved" %}</span>
<span class="badge badge-danger">{% trans "Not solved" %}</span>
{% endif %}
</h2>
@ -47,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ ticket.user.get_full_name }}
</a>
{% else %}
{% trans "Anonymous User" %}
{% trans "Anonymous user" %}
{% endif %}
{{ ticket.date | naturalday}}.
{% if not ticket.user %}
@ -57,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel-body">
<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">
<form class="form" method="post">
@ -65,9 +65,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% bootstrap_form changestatusform %}
{% 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 %}
{% 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 %}
</form>
</div>
@ -76,7 +78,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<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>
{% endblock %}

View file

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

View file

@ -1,13 +1,13 @@
{% load i18n %}
<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="row">
<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 %}
</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>

View file

@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Ticket" %}{% endblock %}
{% block content %}
<h2> {% trans "Tickets settings modification" %}</h2>
<h2> {% trans "Editing of tickets preferences" %}</h2>
{% for message in messages %}
<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 %}
{% bootstrap_field preferencesform.publish_address %}
{% 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>
{% endblock %}

View file

@ -1,4 +1,4 @@
{% extends 'machines/sidebar.html' %}
{% extends 'users/sidebar.html' %}
{% comment %}
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
@ -31,28 +31,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Ticket" %}{% endblock %}
{% block content %}
<h2> Ouverture d'un Ticket </h2>
<h2>{% trans "Ticket opening" %}</h2>
<form class="form" method="post">
{% csrf_token %}
{% 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 %}
{% endif %}
{% bootstrap_field ticketform.title %}
<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">
<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>
<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>
<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>
{% 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>
{% 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 content %}
<h2>{% trans "Tickets" %}</h2>
<h2>{% trans "List of tickets" %}</h2>
{% include 'tickets/aff_tickets.html' with tickets_list=tickets_list %}
{% endblock %}

View file

@ -1,2 +1,2 @@
{% 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 %}
<li>
<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>
</li>

View file

@ -18,11 +18,11 @@
<div class="table-responsive">
<table class="table">
<tr>
<th><p>{% trans "Publication email address"%}</p></th>
<th><p>{% trans "Publication email address" %}</p></th>
{% if preferences.publish_address %}
<td><p>{{ preferences.publish_address }}</p></td>
{% 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 %}
</tr>
<tr>

View file

@ -3,13 +3,13 @@
<div class="panel panel-default">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#ticket">
<h3 class="panel-title pull-left">
<i class="fa fa-ticket"></i>{% trans " Tickets" %}
<i class="fa fa-ticket"></i> {% trans "Tickets" %}
</h3>
</div>
<div id="ticket" class="panel-collapse collapse">
<div class="panel-body">
<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>
</div>
<div class="panel-body">

View file

@ -66,7 +66,7 @@ def new_ticket(request):
messages.success(
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(
@ -77,7 +77,7 @@ def new_ticket(request):
messages.success(
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"))
@ -85,7 +85,7 @@ def new_ticket(request):
messages.error(
request,
_(
"You are not authenticated. Please login or provide an email address so we can get back to you."
"You are not authenticated. Please log in or provide an email address so we can get back to you."
),
)
return form(
@ -149,10 +149,10 @@ def edit_preferences(request):
if preferencesform.is_valid():
if preferencesform.changed_data:
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"))
else:
messages.error(request, "Formulaire Invalide")
messages.error(request, _("Invalid form."))
return form(
{"preferencesform": preferencesform},
"tickets/form_preferences.html",