Commit 0193f474 authored by Laouen Fernet's avatar Laouen Fernet

Translation of re2o/ (front)

parent 0472f913
...@@ -34,6 +34,7 @@ from django.db.models import Model ...@@ -34,6 +34,7 @@ from django.db.models import Model
from django.contrib import messages from django.contrib import messages
from django.shortcuts import redirect from django.shortcuts import redirect
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext as _
def acl_base_decorator(method_name, *targets, on_instance=True): def acl_base_decorator(method_name, *targets, on_instance=True):
...@@ -138,7 +139,7 @@ ModelC) ...@@ -138,7 +139,7 @@ ModelC)
target = target.get_instance(*args, **kwargs) target = target.get_instance(*args, **kwargs)
instances.append(target) instances.append(target)
except target.DoesNotExist: except target.DoesNotExist:
yield False, u"Entrée inexistante" yield False, _("Nonexistent entry.")
return return
if hasattr(target, method_name): if hasattr(target, method_name):
can_fct = getattr(target, method_name) can_fct = getattr(target, method_name)
...@@ -155,7 +156,8 @@ ModelC) ...@@ -155,7 +156,8 @@ ModelC)
if error_messages: if error_messages:
for msg in error_messages: for msg in error_messages:
messages.error( messages.error(
request, msg or "Vous ne pouvez pas accéder à ce menu") request, msg or _("You don't have the right to access"
" this menu."))
return redirect(reverse( return redirect(reverse(
'users:profil', 'users:profil',
kwargs={'userid': str(request.user.id)} kwargs={'userid': str(request.user.id)}
...@@ -219,7 +221,8 @@ def can_delete_set(model): ...@@ -219,7 +221,8 @@ def can_delete_set(model):
instances = model.objects.filter(id__in=instances_id) instances = model.objects.filter(id__in=instances_id)
if not instances: if not instances:
messages.error( messages.error(
request, "Vous ne pouvez pas accéder à ce menu") request, _("You don't have the right to access this menu.")
)
return redirect(reverse( return redirect(reverse(
'users:profil', 'users:profil',
kwargs={'userid': str(request.user.id)} kwargs={'userid': str(request.user.id)}
...@@ -268,10 +271,11 @@ def can_edit_history(view): ...@@ -268,10 +271,11 @@ def can_edit_history(view):
return view(request, *args, **kwargs) return view(request, *args, **kwargs)
messages.error( messages.error(
request, request,
"Vous ne pouvez pas éditer l'historique." _("You don't have the right to edit the history.")
) )
return redirect(reverse( return redirect(reverse(
'users:profil', 'users:profil',
kwargs={'userid': str(request.user.id)} kwargs={'userid': str(request.user.id)}
)) ))
return wrapper return wrapper
...@@ -21,153 +21,189 @@ msgid "" ...@@ -21,153 +21,189 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2.5\n" "Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-23 18:26+0200\n" "POT-Creation-Date: 2018-08-15 16:11+0200\n"
"PO-Revision-Date: 2018-03-31 16:09+0002\n" "PO-Revision-Date: 2018-03-31 16:09+0002\n"
"Last-Translator: Maël Kervella <dev@maelkervella.eu>\n" "Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr_FR\n" "Language: fr_FR\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: settings.py:140 #: acl.py:142
msgid "Nonexistent entry."
msgstr "Entrée inexistante."
#: acl.py:159 acl.py:224
msgid "You don't have the right to access this menu."
msgstr "Vous n'avez pas le droit d'accéder à ce menu."
#: acl.py:274
msgid "You don't have the right to edit the history."
msgstr "Vous n'avez pas le droit de modifier l'historique."
#: mixins.py:111
#, python-format
msgid "You don't have the right to create a %s object."
msgstr "Vous n'avez pas le droit de créer un objet %s."
#: mixins.py:125
#, python-format
msgid "You don't have the right to edit a %s object."
msgstr "Vous n'avez pas le droit de modifier un objet %s."
#: mixins.py:139
#, python-format
msgid "You don't have the right to delete a %s object."
msgstr "Vous n'avez pas le droit de supprimer un objet %s."
#: mixins.py:153
#, python-format
msgid "You don't have the right to view every %s object."
msgstr "Vous n'avez pas le droit de voir tous les objets %s."
#: mixins.py:167
#, python-format
msgid "You don't have the right to view a %s object."
msgstr "Vous n'avez pas le droit de voir un objet %s."
#: settings.py:155
msgid "English" msgid "English"
msgstr "Anglais" msgstr "Anglais"
#: settings.py:141 #: settings.py:156
msgid "French" msgid "French"
msgstr "Français" msgstr "Français"
#: templates/re2o/about.html:29 templates/re2o/about.html:35 #: templates/re2o/about.html:29 templates/re2o/about.html:35
msgid "About Re2o" msgid "About Re2o"
msgstr "A propos de Re2o" msgstr "À propos de Re2o"
#: templates/re2o/about.html:32 #: templates/re2o/about.html:32
#, python-format #, python-format
msgid "About %(AssoName)s" msgid "About %(AssoName)s"
msgstr "A propos de %(AssoName)s" msgstr "À propos de %(AssoName)s"
#: templates/re2o/about.html:36 #: templates/re2o/about.html:36
msgid "" msgid ""
"\n" "Re2o is an administration tool initiated by <a href=\"https://rezometz.org/"
" Re2o is an administration tool initiated by\n" "\">Rezo Supelec Metz</a> and a few members of other <a href=\"https://"
" <a href=\"https://rezometz.org/\">Rezo Supelec Metz</a> and a few\n" "federez.net\">FedeRez</a> associations around the summer 2016.<br /> It is "
" members of other <a href=\"https://federez.net\">FedeRez</a> " "intended to be a tool independant from any network infrastructure so it can "
"associations\n" "be setup in \"a few steps\". This tool is entirely free and available under "
" around the summer 2016.<br />\n" "a GNU Public License v2 (GPLv2) license on <a href=\"https://gitlab.federez."
" It is intended to be a tool independant from any network " "net/federez/re2o/\">FedeRez gitlab</a>.<br /> Re2o's mainteners are "
"infrastructure\n" "volunteers mainly from French schools. <br /> If you want to get involved in "
" so it can be setup in \"a few steps\". This tool is entirely free " "the development process, we will be glad to welcome you so do not hesitate "
"and\n" "to contact us and come help us build the future of Re2o."
" available under a GNU Public License v2 (GPLv2) license on\n"
" <a href=\"https://gitlab.federez.net/federez/re2o/\">FedeRez gitlab</"
"a>.<br />\n"
" Re2o's mainteners are proud volunteers mainly from French "
"engineering\n"
" schools (but not limited to) who have given a lot of their time to "
"make\n"
" this project possible. So please be kind with them.<br />\n"
" If you want to get involved in the development process, we will be "
"glad to\n"
" welcome you so do not hesitate to contact us and come help us build "
"the\n"
" future of Re2o.\n"
" "
msgstr "" msgstr ""
"\n" "Re2o est un outil d'administration initié par <a href=\"https://rezometz.org/"
" Re2o est un outil d'administration initié par\n" "\">Rézo Supélec Metz</a> et quelques membres d'autres assocations de <a href="
" <a href=\"https://rezometz.org/\">Rezo Supelec Metz</a> et quelques\n" "\"https://federez.net\">FedeRez</a> autour de l'été 2016.<br /> Il se veut "
" membres d'autres assocations de <a href=\"https://federez.net" "être un outil indépendant de toute infrastructure réseau pour pouvoir être "
"\">FedeRez</a>\n" "installé en \"quelques étapes\". Cet outil est entièrement gratuit et est "
" autour de l'été 2016.<br />\n" "disponible sous license GNU Public License v2 (GPLv2) sur le<a href="
" Il se veut être un outil idépendant de toute infrastructure réseau\n" "\"https://gitlab.federez.net/federez/re2o/\">gitlab de FedeRez</a>.<br />\n"
" pour pouvoir être installé en \"quelques étapes\". Cet outil est " "Les mainteneurs de Re2o sont de fiers bénévoles venant principalement "
"entièrement gratuit et\n" "d'écoles d'ingénieurs françaises (mais pas seulement) qui ont donné beaucoup "
" est disponible sous license GNU Public License v2 (GPLv2) sur le\n" "de leur temps pour faire en sorte que ce projet soit possible. Donc s'il "
" <a href=\"https://gitlab.federez.net/federez/re2o/\">gitlab de " "vous plait soyez gentils avez eux.<br /> Si vous voulez prendre part au "
"FedeRez</a>.<br />\n" "développement, nous serons heureux de vous accueillir donc n'hésitez pas à "
" Les mainteneurs de Re2o sont de fiers bénévoles venant " "nous contacter et à venir nous aider à construire le futur de Re2o."
"principalement d'écoles d'ingénieurs françaises\n"
" (mais pas seulement) qui ont donné beaucoup de leur temps pour faire " #: templates/re2o/about.html:55
"en sorte que\n"
" ce projet soit possible. Donc s'il vous plait soyez gentils avez eux."
"<br />\n"
" Si vous voulez prendre part au développement, nous serons heureux "
"de\n"
" vous accueillir donc n'hésitez pas à nous contacter et à venir nous "
"aider à construire le\n"
" futur de Re2o.\n"
" "
#: templates/re2o/about.html:57
msgid "Contributors list" msgid "Contributors list"
msgstr "Liste des contributeurs" msgstr "Liste des contributeurs"
#: templates/re2o/about.html:66 #: templates/re2o/about.html:64
msgid "Version informations" msgid "Version information"
msgstr "Informations de versions" msgstr "Informations de versions"
#: templates/re2o/about.html:68 #: templates/re2o/about.html:66
#, python-format #, python-format
msgid "" msgid "<b>Remote URL</b>: %(git_info_remote)s"
"\n" msgstr "<b>URL distante</b> : %(git_info_remote)s"
" <b>Remote URL</b>: %(git_info_remote)s\n"
" "
msgstr ""
"\n"
" <b>URL distante</b> : %(git_info_remote)s\n"
" "
#: templates/re2o/about.html:71 #: templates/re2o/about.html:69
#, python-format #, python-format
msgid "" msgid "<b>Branch</b>: %(git_info_branch)s"
"\n" msgstr "<b>Branche</b> : %(git_info_branch)s"
" <b>Branch</b>: %(git_info_branch)s\n"
" "
msgstr ""
"\n"
" <b>Branche</b> : %(git_info_branch)s\n"
" "
#: templates/re2o/about.html:74 #: templates/re2o/about.html:72
#, python-format #, python-format
msgid "" msgid "<b>Commit</b>: %(git_info_commit)s"
"\n" msgstr "<b>Commit</b> : %(git_info_commit)s"
" <b>Commit</b>: %(git_info_commit)s\n"
" "
msgstr ""
"\n"
" <b>Commit</b> : %(git_info_commit)s\n"
" "
#: templates/re2o/about.html:77 #: templates/re2o/about.html:75
#, python-format #, python-format
msgid "" msgid "<b>Commit date</b>: %(git_info_commit_date)s"
"\n" msgstr "<b>Date du commit</b> : %(git_info_commit_date)s"
" <b>Commit date</b>: %(git_info_commit_date)s\n"
" "
msgstr ""
"\n"
" <b>Date du commit</b> : %(git_info_commit_date)s\n"
" "
#: templates/re2o/about.html:82 #: templates/re2o/about.html:80
msgid "Dependencies" msgid "Dependencies"
msgstr "Dépendances" msgstr "Dépendances"
#: templates/re2o/aff_history.html:30
msgid "Next"
msgstr "Suivant"
#: templates/re2o/aff_history.html:37
msgid "Previous"
msgstr "Précédent"
#: templates/re2o/aff_history.html:45
msgid "Date"
msgstr "Date"
#: templates/re2o/aff_history.html:46
msgid "Performed by"
msgstr "Effectuée par"
#: templates/re2o/aff_history.html:47
msgid "Comment"
msgstr "Commentaire"
#: templates/re2o/contact.html:29
msgid "Contact"
msgstr "Contact"
#: templates/re2o/contact.html:32
#, python-format
msgid "Contact the organisation %(asso_name)s"
msgstr "Contacter l'association %(asso_name)s"
#: templates/re2o/history.html:29
msgid "History"
msgstr "Historique"
#: templates/re2o/history.html:32
#, python-format
msgid "History of %(object)s"
msgstr "Historique de %(object)s"
#: templates/re2o/index.html:30 #: templates/re2o/index.html:30
msgid "Home" msgid "Home"
msgstr "Accueil" msgstr "Accueil"
#: templates/re2o/index.html:33 #: templates/re2o/index.html:33
#, python-format #, python-format
msgid "Welcome to %(name_website)s !" msgid "Welcome to %(name_website)s!"
msgstr "Bienvenue sur %(name_website)s !" msgstr "Bienvenue sur %(name_website)s !"
#: templates/re2o/index.html:47 #: templates/re2o/index.html:47
msgid "Go there" msgid "Go there"
msgstr "Accéder" msgstr "Accéder"
#: views.py:205 #: templates/re2o/sidebar.html:47
#, python-format
msgid "Tweets from @%(twitter_account_name)s"
msgstr "Tweets de @%(twitter_account_name)s"
#: templates/re2o/sidebar.html:50
#, python-format
msgid "Follow @%(twitter_account_name)s"
msgstr "Suivre @%(twitter_account_name)s"
#: views.py:87
msgid "Unable to get the information" msgid "Unable to get the information"
msgstr "Impossible d'obtenir l'information" msgstr "Impossible d'obtenir l'information"
...@@ -25,6 +25,7 @@ A set of mixins used all over the project to avoid duplicating code ...@@ -25,6 +25,7 @@ A set of mixins used all over the project to avoid duplicating code
from reversion import revisions as reversion from reversion import revisions as reversion
from django.db import transaction from django.db import transaction
from django.utils.translation import ugettext as _
class RevMixin(object): class RevMixin(object):
...@@ -35,14 +36,14 @@ class RevMixin(object): ...@@ -35,14 +36,14 @@ class RevMixin(object):
""" Creates a version of this object and save it to database """ """ Creates a version of this object and save it to database """
if self.pk is None: if self.pk is None:
with transaction.atomic(), reversion.create_revision(): with transaction.atomic(), reversion.create_revision():
reversion.set_comment("Création") reversion.set_comment("Creation")
return super(RevMixin, self).save(*args, **kwargs) return super(RevMixin, self).save(*args, **kwargs)
return super(RevMixin, self).save(*args, **kwargs) return super(RevMixin, self).save(*args, **kwargs)
def delete(self, *args, **kwargs): def delete(self, *args, **kwargs):
""" Creates a version of this object and delete it from database """ """ Creates a version of this object and delete it from database """
with transaction.atomic(), reversion.create_revision(): with transaction.atomic(), reversion.create_revision():
reversion.set_comment("Suppresion") reversion.set_comment("Deletion")
return super(RevMixin, self).delete(*args, **kwargs) return super(RevMixin, self).delete(*args, **kwargs)
...@@ -58,7 +59,7 @@ class FormRevMixin(object): ...@@ -58,7 +59,7 @@ class FormRevMixin(object):
) )
elif self.changed_data: elif self.changed_data:
reversion.set_comment( reversion.set_comment(
"Champs modifié(s) : %s" "Field(s) altered : %s"
% ', '.join(field for field in self.changed_data) % ', '.join(field for field in self.changed_data)
) )
return super(FormRevMixin, self).save(*args, **kwargs) return super(FormRevMixin, self).save(*args, **kwargs)
...@@ -107,7 +108,8 @@ class AclMixin(object): ...@@ -107,7 +108,8 @@ class AclMixin(object):
user_request.has_perm( user_request.has_perm(
cls.get_modulename() + '.add_' + cls.get_classname() cls.get_modulename() + '.add_' + cls.get_classname()
), ),
u"Vous n'avez pas le droit de créer un " + cls.get_classname() (_("You don't have the right to create a %s object.")
% cls.get_classname())
) )
def can_edit(self, user_request, *_args, **_kwargs): def can_edit(self, user_request, *_args, **_kwargs):
...@@ -120,7 +122,8 @@ class AclMixin(object): ...@@ -120,7 +122,8 @@ class AclMixin(object):
user_request.has_perm( user_request.has_perm(
self.get_modulename() + '.change_' + self.get_classname() self.get_modulename() + '.change_' + self.get_classname()
), ),
u"Vous n'avez pas le droit d'éditer des " + self.get_classname() (_("You don't have the right to edit a %s object.")
% self.get_classname())
) )
def can_delete(self, user_request, *_args, **_kwargs): def can_delete(self, user_request, *_args, **_kwargs):
...@@ -133,7 +136,8 @@ class AclMixin(object): ...@@ -133,7 +136,8 @@ class AclMixin(object):
user_request.has_perm( user_request.has_perm(
self.get_modulename() + '.delete_' + self.get_classname() self.get_modulename() + '.delete_' + self.get_classname()
), ),
u"Vous n'avez pas le droit d'éditer des " + self.get_classname() (_("You don't have the right to delete a %s object.")
% self.get_classname())
) )
@classmethod @classmethod
...@@ -146,7 +150,8 @@ class AclMixin(object): ...@@ -146,7 +150,8 @@ class AclMixin(object):
user_request.has_perm( user_request.has_perm(
cls.get_modulename() + '.view_' + cls.get_classname() cls.get_modulename() + '.view_' + cls.get_classname()
), ),
u"Vous n'avez pas le droit de voir des " + cls.get_classname() (_("You don't have the right to view every %s object.")
% cls.get_classname())
) )
def can_view(self, user_request, *_args, **_kwargs): def can_view(self, user_request, *_args, **_kwargs):
...@@ -159,5 +164,7 @@ class AclMixin(object): ...@@ -159,5 +164,7 @@ class AclMixin(object):
user_request.has_perm( user_request.has_perm(
self.get_modulename() + '.view_' + self.get_classname() self.get_modulename() + '.view_' + self.get_classname()
), ),
u"Vous n'avez pas le droit de voir des " + self.get_classname() (_("You don't have the right to view a %s object.")
% self.get_classname())
) )
...@@ -50,10 +50,10 @@ def get_user(pseudo): ...@@ -50,10 +50,10 @@ def get_user(pseudo):
"""Cherche un utilisateur re2o à partir de son pseudo""" """Cherche un utilisateur re2o à partir de son pseudo"""
user = User.objects.filter(pseudo=pseudo) user = User.objects.filter(pseudo=pseudo)
if len(user) == 0: if len(user) == 0:
raise CommandError("Utilisateur invalide") raise CommandError("Invalid user.")
if len(user) > 1: if len(user) > 1:
raise CommandError("Plusieurs utilisateurs correspondant à ce " raise CommandError("Several users match this username. This SHOULD"
"pseudo. Ceci NE DEVRAIT PAS arriver") " NOT happen.")
return user[0] return user[0]
...@@ -81,19 +81,19 @@ def form_cli(Form, user, action, *args, **kwargs): ...@@ -81,19 +81,19 @@ def form_cli(Form, user, action, *args, **kwargs):
form = Form(data, user=user, *args, **kwargs) form = Form(data, user=user, *args, **kwargs)
if not form.is_valid(): if not form.is_valid():
sys.stderr.write("Erreurs : \n") sys.stderr.write("Errors: \n")
for err in form.errors: for err in form.errors:
# Oui, oui, on gère du HTML là où d'autres ont eu la # Oui, oui, on gère du HTML là où d'autres ont eu la
# lumineuse idée de le mettre # lumineuse idée de le mettre
sys.stderr.write( sys.stderr.write(
"\t%s : %s\n" % (err, strip_tags(form.errors[err])) "\t%s : %s\n" % (err, strip_tags(form.errors[err]))
) )
raise CommandError("Formulaire invalide") raise CommandError("Invalid form.")
with transaction.atomic(), reversion.create_revision(): with transaction.atomic(), reversion.create_revision():
form.save() form.save()
reversion.set_user(user) reversion.set_user(user)
reversion.set_comment(action) reversion.set_comment(action)
sys.stdout.write("%s : effectué. La modification peut prendre " sys.stdout.write("%s : done. The edit may take several minutes to"
"quelques minutes pour s'appliquer.\n" % action) " apply.\n" % action)
...@@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., ...@@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ description | safe }} {{ description | safe }}
<h2>{% trans "About Re2o" %}</h2> <h2>{% trans "About Re2o" %}</h2>
<p>{% blocktrans %} <p>{% blocktrans trimmed %}
Re2o is an administration tool initiated by Re2o is an administration tool initiated by
<a href="https://rezometz.org/">Rezo Supelec Metz</a> and a few <a href="https://rezometz.org/">Rezo Supelec Metz</a> and a few
members of other <a href="https://federez.net">FedeRez</a> associations members of other <a href="https://federez.net">FedeRez</a> associations
...@@ -61,18 +61,18 @@ with this program; if not, write to the Free Software Foundation, Inc., ...@@ -61,18 +61,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<h3>{% trans "Version informations" %}</h3> <h3>{% trans "Version information" %}</h3>
<ul> <ul>
<li>{% blocktrans %} <li>{% blocktrans trimmed %}
<b>Remote URL</b>: {{ git_info_remote }} <b>Remote URL</b>: {{ git_info_remote }}
{% endblocktrans %}</li> {% endblocktrans %}</li>
<li>{% blocktrans %} <li>{% blocktrans trimmed %}
<b>Branch</b>: {{ git_info_branch }} <b>Branch</b>: {{ git_info_branch }}
{% endblocktrans %}</li> {% endblocktrans %}</li>
<li>{% blocktrans %} <li>{% blocktrans trimmed %}
<b>Commit</b>: {{ git_info_commit }} <b>Commit</b>: {{ git_info_commit }}
{% endblocktrans %}</li> {% endblocktrans %}</li>
<li>{% blocktrans %} <li>{% blocktrans trimmed %}
<b>Commit date</b>: {{ git_info_commit_date }} <b>Commit date</b>: {{ git_info_commit_date }}
{% endblocktrans %}</li> {% endblocktrans %}</li>
</ul> </ul>
......
...@@ -22,17 +22,19 @@ with this program; if not, write to the Free Software Foundation, Inc., ...@@ -22,17 +22,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load i18n %}
{% if reversions.paginator %} {% if reversions.paginator %}
<ul class="pagination nav navbar-nav"> <ul class="pagination nav navbar-nav">
{% if reversions.has_previous %} {% if reversions.has_previous %}
<li><a href="?page={{ reversions.previous_page_number }}">Suivants</a></li> <li><a href="?page={{ reversions.previous_page_number }}">{% trans "Next" %}</a></li>
{% endif %} {% endif %}
{% for page in reversions.paginator.page_range %} {% for page in reversions.paginator.page_range %}
<li class="{% if reversions.number == page %}active{% endif %}"><a href="?page={{page }}">{{ page }}</a></li> <li class="{% if reversions.number == page %}active{% endif %}"><a href="?page={{page }}">{{ page }}</a></li>
{% endfor %} {% endfor %}
{% if reversions.has_next %} {% if reversions.has_next %}
<li> <a href="?page={{ reversions.next_page_number }}">Précédents</a></li> <li> <a href="?page={{ reversions.next_page_number }}">{% trans "Previous" %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
{% endif %} {% endif %}
...@@ -40,9 +42,9 @@ with this program; if not, write to the Free Software Foundation, Inc., ...@@ -40,9 +42,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,