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
from django.contrib import messages
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext as _
def acl_base_decorator(method_name, *targets, on_instance=True):
......@@ -138,7 +139,7 @@ ModelC)
target = target.get_instance(*args, **kwargs)
instances.append(target)
except target.DoesNotExist:
yield False, u"Entrée inexistante"
yield False, _("Nonexistent entry.")
return
if hasattr(target, method_name):
can_fct = getattr(target, method_name)
......@@ -155,7 +156,8 @@ ModelC)
if error_messages:
for msg in error_messages:
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(
'users:profil',
kwargs={'userid': str(request.user.id)}
......@@ -219,7 +221,8 @@ def can_delete_set(model):
instances = model.objects.filter(id__in=instances_id)
if not instances:
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(
'users:profil',
kwargs={'userid': str(request.user.id)}
......@@ -268,10 +271,11 @@ def can_edit_history(view):
return view(request, *args, **kwargs)
messages.error(
request,
"Vous ne pouvez pas éditer l'historique."
_("You don't have the right to edit the history.")
)
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
return wrapper
......@@ -21,153 +21,189 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.5\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"
"Last-Translator: Maël Kervella <dev@maelkervella.eu>\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\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"
msgstr "Anglais"
#: settings.py:141
#: settings.py:156
msgid "French"
msgstr "Français"
#: templates/re2o/about.html:29 templates/re2o/about.html:35
msgid "About Re2o"
msgstr "A propos de Re2o"
msgstr "À propos de Re2o"
#: templates/re2o/about.html:32
#, python-format
msgid "About %(AssoName)s"
msgstr "A propos de %(AssoName)s"
msgstr "À propos de %(AssoName)s"
#: templates/re2o/about.html:36
msgid ""
"\n"
" Re2o is an administration tool initiated by\n"
" <a href=\"https://rezometz.org/\">Rezo Supelec Metz</a> and a few\n"
" members of other <a href=\"https://federez.net\">FedeRez</a> "
"associations\n"
" around the summer 2016.<br />\n"
" It is intended to be a tool independant from any network "
"infrastructure\n"
" so it can be setup in \"a few steps\". This tool is entirely free "
"and\n"
" 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"
" "
"Re2o is an administration tool initiated by <a href=\"https://rezometz.org/"
"\">Rezo Supelec Metz</a> and a few members of other <a href=\"https://"
"federez.net\">FedeRez</a> associations around the summer 2016.<br /> It is "
"intended to be a tool independant from any network infrastructure so it can "
"be setup in \"a few steps\". This tool is entirely free and available under "
"a GNU Public License v2 (GPLv2) license on <a href=\"https://gitlab.federez."
"net/federez/re2o/\">FedeRez gitlab</a>.<br /> Re2o's mainteners are "
"volunteers mainly from French schools. <br /> If you want to get involved in "
"the development process, we will be glad to welcome you so do not hesitate "
"to contact us and come help us build the future of Re2o."
msgstr ""
"\n"
" Re2o est un outil d'administration initié par\n"
" <a href=\"https://rezometz.org/\">Rezo Supelec Metz</a> et quelques\n"
" membres d'autres assocations de <a href=\"https://federez.net"
"\">FedeRez</a>\n"
" autour de l'été 2016.<br />\n"
" Il se veut être un outil idépendant de toute infrastructure réseau\n"
" pour pouvoir être installé en \"quelques étapes\". Cet outil est "
"entièrement gratuit et\n"
" est disponible sous license GNU Public License v2 (GPLv2) sur le\n"
" <a href=\"https://gitlab.federez.net/federez/re2o/\">gitlab de "
"FedeRez</a>.<br />\n"
" Les mainteneurs de Re2o sont de fiers bénévoles venant "
"principalement d'écoles d'ingénieurs françaises\n"
" (mais pas seulement) qui ont donné beaucoup de leur temps pour faire "
"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
"Re2o est un outil d'administration initié par <a href=\"https://rezometz.org/"
"\">Rézo Supélec Metz</a> et quelques membres d'autres assocations de <a href="
"\"https://federez.net\">FedeRez</a> autour de l'été 2016.<br /> Il se veut "
"être un outil indépendant de toute infrastructure réseau pour pouvoir être "
"installé en \"quelques étapes\". Cet outil est entièrement gratuit et est "
"disponible sous license GNU Public License v2 (GPLv2) sur le<a href="
"\"https://gitlab.federez.net/federez/re2o/\">gitlab de FedeRez</a>.<br />\n"
"Les mainteneurs de Re2o sont de fiers bénévoles venant principalement "
"d'écoles d'ingénieurs françaises (mais pas seulement) qui ont donné beaucoup "
"de leur temps pour faire en sorte que ce projet soit possible. Donc s'il "
"vous plait soyez gentils avez eux.<br /> Si vous voulez prendre part au "
"développement, nous serons heureux de vous accueillir donc n'hésitez pas à "
"nous contacter et à venir nous aider à construire le futur de Re2o."
#: templates/re2o/about.html:55
msgid "Contributors list"
msgstr "Liste des contributeurs"
#: templates/re2o/about.html:66
msgid "Version informations"
#: templates/re2o/about.html:64
msgid "Version information"
msgstr "Informations de versions"
#: templates/re2o/about.html:68
#: templates/re2o/about.html:66
#, python-format
msgid ""
"\n"
" <b>Remote URL</b>: %(git_info_remote)s\n"
" "
msgstr ""
"\n"
" <b>URL distante</b> : %(git_info_remote)s\n"
" "
msgid "<b>Remote URL</b>: %(git_info_remote)s"
msgstr "<b>URL distante</b> : %(git_info_remote)s"
#: templates/re2o/about.html:71
#: templates/re2o/about.html:69
#, python-format
msgid ""
"\n"
" <b>Branch</b>: %(git_info_branch)s\n"
" "
msgstr ""
"\n"
" <b>Branche</b> : %(git_info_branch)s\n"
" "
msgid "<b>Branch</b>: %(git_info_branch)s"
msgstr "<b>Branche</b> : %(git_info_branch)s"
#: templates/re2o/about.html:74
#: templates/re2o/about.html:72
#, python-format
msgid ""
"\n"
" <b>Commit</b>: %(git_info_commit)s\n"
" "
msgstr ""
"\n"
" <b>Commit</b> : %(git_info_commit)s\n"
" "
msgid "<b>Commit</b>: %(git_info_commit)s"
msgstr "<b>Commit</b> : %(git_info_commit)s"
#: templates/re2o/about.html:77
#: templates/re2o/about.html:75
#, python-format
msgid ""
"\n"
" <b>Commit date</b>: %(git_info_commit_date)s\n"
" "
msgstr ""
"\n"
" <b>Date du commit</b> : %(git_info_commit_date)s\n"
" "
msgid "<b>Commit date</b>: %(git_info_commit_date)s"
msgstr "<b>Date du commit</b> : %(git_info_commit_date)s"
#: templates/re2o/about.html:82
#: templates/re2o/about.html:80
msgid "Dependencies"
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
msgid "Home"
msgstr "Accueil"
#: templates/re2o/index.html:33
#, python-format
msgid "Welcome to %(name_website)s !"
msgid "Welcome to %(name_website)s!"
msgstr "Bienvenue sur %(name_website)s !"
#: templates/re2o/index.html:47
msgid "Go there"
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"
msgstr "Impossible d'obtenir l'information"
......@@ -25,6 +25,7 @@ A set of mixins used all over the project to avoid duplicating code
from reversion import revisions as reversion
from django.db import transaction
from django.utils.translation import ugettext as _
class RevMixin(object):
......@@ -35,14 +36,14 @@ class RevMixin(object):
""" Creates a version of this object and save it to database """
if self.pk is None:
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)
def delete(self, *args, **kwargs):
""" Creates a version of this object and delete it from database """
with transaction.atomic(), reversion.create_revision():
reversion.set_comment("Suppresion")
reversion.set_comment("Deletion")
return super(RevMixin, self).delete(*args, **kwargs)
......@@ -58,7 +59,7 @@ class FormRevMixin(object):
)
elif self.changed_data:
reversion.set_comment(
"Champs modifié(s) : %s"
"Field(s) altered : %s"
% ', '.join(field for field in self.changed_data)
)
return super(FormRevMixin, self).save(*args, **kwargs)
......@@ -107,7 +108,8 @@ class AclMixin(object):
user_request.has_perm(
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):
......@@ -120,7 +122,8 @@ class AclMixin(object):
user_request.has_perm(
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):
......@@ -133,7 +136,8 @@ class AclMixin(object):
user_request.has_perm(
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
......@@ -146,7 +150,8 @@ class AclMixin(object):
user_request.has_perm(
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):
......@@ -159,5 +164,7 @@ class AclMixin(object):
user_request.has_perm(
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):
"""Cherche un utilisateur re2o à partir de son pseudo"""
user = User.objects.filter(pseudo=pseudo)
if len(user) == 0:
raise CommandError("Utilisateur invalide")
raise CommandError("Invalid user.")
if len(user) > 1:
raise CommandError("Plusieurs utilisateurs correspondant à ce "
"pseudo. Ceci NE DEVRAIT PAS arriver")
raise CommandError("Several users match this username. This SHOULD"
" NOT happen.")
return user[0]
......@@ -81,19 +81,19 @@ def form_cli(Form, user, action, *args, **kwargs):
form = Form(data, user=user, *args, **kwargs)
if not form.is_valid():
sys.stderr.write("Erreurs : \n")
sys.stderr.write("Errors: \n")
for err in form.errors:
# Oui, oui, on gère du HTML là où d'autres ont eu la
# lumineuse idée de le mettre
sys.stderr.write(
"\t%s : %s\n" % (err, strip_tags(form.errors[err]))
)
raise CommandError("Formulaire invalide")
raise CommandError("Invalid form.")
with transaction.atomic(), reversion.create_revision():
form.save()
reversion.set_user(user)
reversion.set_comment(action)
sys.stdout.write("%s : effectué. La modification peut prendre "
"quelques minutes pour s'appliquer.\n" % action)
sys.stdout.write("%s : done. The edit may take several minutes to"
" apply.\n" % action)
......@@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ description | safe }}
<h2>{% trans "About Re2o" %}</h2>
<p>{% blocktrans %}
<p>{% blocktrans trimmed %}
Re2o is an administration tool initiated by
<a href="https://rezometz.org/">Rezo Supelec Metz</a> and a few
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.,
</div>
<div class="col-md-6">
<h3>{% trans "Version informations" %}</h3>
<h3>{% trans "Version information" %}</h3>
<ul>
<li>{% blocktrans %}
<li>{% blocktrans trimmed %}
<b>Remote URL</b>: {{ git_info_remote }}
{% endblocktrans %}</li>
<li>{% blocktrans %}
<li>{% blocktrans trimmed %}
<b>Branch</b>: {{ git_info_branch }}
{% endblocktrans %}</li>
<li>{% blocktrans %}
<li>{% blocktrans trimmed %}
<b>Commit</b>: {{ git_info_commit }}
{% endblocktrans %}</li>
<li>{% blocktrans %}
<li>{% blocktrans trimmed %}
<b>Commit date</b>: {{ git_info_commit_date }}
{% endblocktrans %}</li>
</ul>
......
......@@ -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.
{% endcomment %}
{% load i18n %}
{% if reversions.paginator %}
<ul class="pagination nav navbar-nav">
{% 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 %}
{% for page in reversions.paginator.page_range %}
<li class="{% if reversions.number == page %}active{% endif %}"><a href="?page={{page }}">{{ page }}</a></li>
{% endfor %}
{% 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 %}
</ul>
{% endif %}
......@@ -40,9 +42,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table class="table table-striped">
<thead>
<tr>
<th>Date</th>
<th>Effectué par</th>
<th>Commentaire</th>
<th>{% trans "Date" %}</th>
<th>{% trans "Performed by" %}</th>
<th>{% trans "Comment" %}</th>
</tr>
</thead>
{% for rev in reversions %}
......@@ -53,3 +55,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr>
{% endfor %}
</table>
......@@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Contact" %}{% endblock %}
{% block content %}
<h2>{% blocktrans %}Contacter l'association {{asso_name}}{% endblocktrans %}</h2>
<h2>{% blocktrans %}Contact the organisation {{asso_name}}{% endblocktrans %}</h2>
</br>
{% for contact in contacts %}
......@@ -45,8 +45,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
{% endfor %}
{% endblock %}
......@@ -24,11 +24,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load bootstrap3 %}
{% load i18n %}
{% block title %}Historique{% endblock %}
{% block title %}{% trans "History" %}{% endblock %}
{% block content %}
<h2>Historique de {{ object }}</h2>
<h2>{% blocktrans %}History of {{ object }}{% endblocktrans %}</h2>
{% include "re2o/aff_history.html" with reversions=reversions %}
<br />
<br />
......
......@@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Home" %}{% endblock %}
{% block content %}
<h1>{% blocktrans %}Welcome to {{ name_website }} !{% endblocktrans %}</h1>
<h1>{% blocktrans %}Welcome to {{ name_website }}!{% endblocktrans %}</h1>
<div class="row">
{% for service_list in services_urls %}
......
......@@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load i18n %}
{% block sidebar %}
......@@ -43,10 +44,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endif %}
{% if twitter_url %}
<a class="twitter-timeline" data-lang="fr" data-height="500" href="{{ twitter_url }}?ref_src=twsrc%5Etfw">Tweets de @{{ twitter_account_name }}</a>
<a class="twitter-timeline" data-lang="fr" data-height="500" href="{{ twitter_url }}?ref_src=twsrc%5Etfw">{% blocktrans %}Tweets from @{{ twitter_account_name }}{% endblocktrans %}</a>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<a href="{{ twitter_url }}?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="false"> Suivre @{{ twitter_account_name }}</a>
<a href="{{ twitter_url }}?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="false">{% blocktrans %}Follow @{{ twitter_account_name }}{% endblocktrans %}</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
{% endif %}
......
......@@ -131,3 +131,4 @@ def handler500(request):
def handler404(request):
"""The handler view for a 404 error"""
return render(request, 'errors/404.html')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment