diff --git a/re2o/acl.py b/re2o/acl.py index bd304443..116d273b 100644 --- a/re2o/acl.py +++ b/re2o/acl.py @@ -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 + diff --git a/re2o/locale/fr/LC_MESSAGES/django.mo b/re2o/locale/fr/LC_MESSAGES/django.mo index c0bdc974..7e9e55c3 100644 Binary files a/re2o/locale/fr/LC_MESSAGES/django.mo and b/re2o/locale/fr/LC_MESSAGES/django.mo differ diff --git a/re2o/locale/fr/LC_MESSAGES/django.po b/re2o/locale/fr/LC_MESSAGES/django.po index cd293d53..86ed6316 100644 --- a/re2o/locale/fr/LC_MESSAGES/django.po +++ b/re2o/locale/fr/LC_MESSAGES/django.po @@ -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 \n" +"Last-Translator: Laouen Fernet \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" -" Rezo Supelec Metz and a few\n" -" members of other FedeRez " -"associations\n" -" around the summer 2016.
\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" -" FedeRez gitlab.
\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.
\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
Rezo Supelec Metz and a few members of other FedeRez associations around the summer 2016.
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 FedeRez gitlab.
Re2o's mainteners are " +"volunteers mainly from French schools.
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" -" Rezo Supelec Metz et quelques\n" -" membres d'autres assocations de FedeRez\n" -" autour de l'été 2016.
\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" -" gitlab de " -"FedeRez.
\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." -"
\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" -" " +"Re2o est un outil d'administration initié par Rézo Supélec Metz et quelques membres d'autres assocations de FedeRez autour de l'été 2016.
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 legitlab de FedeRez.
\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.
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:57 +#: 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" -" Remote URL: %(git_info_remote)s\n" -" " -msgstr "" -"\n" -" URL distante : %(git_info_remote)s\n" -" " +msgid "Remote URL: %(git_info_remote)s" +msgstr "URL distante : %(git_info_remote)s" -#: templates/re2o/about.html:71 +#: templates/re2o/about.html:69 #, python-format -msgid "" -"\n" -" Branch: %(git_info_branch)s\n" -" " -msgstr "" -"\n" -" Branche : %(git_info_branch)s\n" -" " +msgid "Branch: %(git_info_branch)s" +msgstr "Branche : %(git_info_branch)s" -#: templates/re2o/about.html:74 +#: templates/re2o/about.html:72 #, python-format -msgid "" -"\n" -" Commit: %(git_info_commit)s\n" -" " -msgstr "" -"\n" -" Commit : %(git_info_commit)s\n" -" " +msgid "Commit: %(git_info_commit)s" +msgstr "Commit : %(git_info_commit)s" -#: templates/re2o/about.html:77 +#: templates/re2o/about.html:75 #, python-format -msgid "" -"\n" -" Commit date: %(git_info_commit_date)s\n" -" " -msgstr "" -"\n" -" Date du commit : %(git_info_commit_date)s\n" -" " +msgid "Commit date: %(git_info_commit_date)s" +msgstr "Date du commit : %(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" diff --git a/re2o/mixins.py b/re2o/mixins.py index 2ee049cc..f3858428 100644 --- a/re2o/mixins.py +++ b/re2o/mixins.py @@ -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()) ) + diff --git a/re2o/script_utils.py b/re2o/script_utils.py index e1420e6d..92c00fab 100644 --- a/re2o/script_utils.py +++ b/re2o/script_utils.py @@ -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) diff --git a/re2o/templates/re2o/about.html b/re2o/templates/re2o/about.html index d960067a..f7afc69c 100644 --- a/re2o/templates/re2o/about.html +++ b/re2o/templates/re2o/about.html @@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {{ description | safe }}

{% trans "About Re2o" %}

-

{% blocktrans %} +

{% blocktrans trimmed %} Re2o is an administration tool initiated by Rezo Supelec Metz and a few members of other FedeRez associations @@ -61,18 +61,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,

-

{% trans "Version informations" %}

+

{% trans "Version information" %}

    -
  • {% blocktrans %} +
  • {% blocktrans trimmed %} Remote URL: {{ git_info_remote }} {% endblocktrans %}
  • -
  • {% blocktrans %} +
  • {% blocktrans trimmed %} Branch: {{ git_info_branch }} {% endblocktrans %}
  • -
  • {% blocktrans %} +
  • {% blocktrans trimmed %} Commit: {{ git_info_commit }} {% endblocktrans %}
  • -
  • {% blocktrans %} +
  • {% blocktrans trimmed %} Commit date: {{ git_info_commit_date }} {% endblocktrans %}
diff --git a/re2o/templates/re2o/aff_history.html b/re2o/templates/re2o/aff_history.html index d7be350c..7079d7de 100644 --- a/re2o/templates/re2o/aff_history.html +++ b/re2o/templates/re2o/aff_history.html @@ -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 %} {% endif %} @@ -40,9 +42,9 @@ with this program; if not, write to the Free Software Foundation, Inc., - - - + + + {% for rev in reversions %} @@ -53,3 +55,4 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endfor %}
DateEffectué parCommentaire{% trans "Date" %}{% trans "Performed by" %}{% trans "Comment" %}
+ diff --git a/re2o/templates/re2o/contact.html b/re2o/templates/re2o/contact.html index f2de696d..f26e002b 100644 --- a/re2o/templates/re2o/contact.html +++ b/re2o/templates/re2o/contact.html @@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block title %}{% trans "Contact" %}{% endblock %} {% block content %} -

{% blocktrans %}Contacter l'association {{asso_name}}{% endblocktrans %}

+

{% blocktrans %}Contact the organisation {{asso_name}}{% endblocktrans %}


{% for contact in contacts %} @@ -45,8 +45,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %} - - {% endblock %} diff --git a/re2o/templates/re2o/history.html b/re2o/templates/re2o/history.html index e9d654d9..945a355e 100644 --- a/re2o/templates/re2o/history.html +++ b/re2o/templates/re2o/history.html @@ -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 %} -

Historique de {{ object }}

+

{% blocktrans %}History of {{ object }}{% endblocktrans %}

{% include "re2o/aff_history.html" with reversions=reversions %}

diff --git a/re2o/templates/re2o/index.html b/re2o/templates/re2o/index.html index 5b505c0f..28adf055 100644 --- a/re2o/templates/re2o/index.html +++ b/re2o/templates/re2o/index.html @@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block title %}{% trans "Home" %}{% endblock %} {% block content %} -

{% blocktrans %}Welcome to {{ name_website }} !{% endblocktrans %}

+

{% blocktrans %}Welcome to {{ name_website }}!{% endblocktrans %}

{% for service_list in services_urls %} diff --git a/re2o/templates/re2o/sidebar.html b/re2o/templates/re2o/sidebar.html index ad64caae..c9202d14 100644 --- a/re2o/templates/re2o/sidebar.html +++ b/re2o/templates/re2o/sidebar.html @@ -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 %} - + - + {% endif %} diff --git a/re2o/views.py b/re2o/views.py index c3f13332..15becb35 100644 --- a/re2o/views.py +++ b/re2o/views.py @@ -131,3 +131,4 @@ def handler500(request): def handler404(request): """The handler view for a 404 error""" return render(request, 'errors/404.html') +