From 950272dc189ca88734a84a3f6efc603a809f574f Mon Sep 17 00:00:00 2001 From: Laouen Fernet Date: Wed, 9 Jan 2019 00:37:45 +0100 Subject: [PATCH] add translations for api/ --- api/acl.py | 5 ++-- api/authentication.py | 2 +- api/locale/fr/LC_MESSAGES/django.po | 40 +++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 api/locale/fr/LC_MESSAGES/django.po diff --git a/api/acl.py b/api/acl.py index 9107a25d..0c336281 100644 --- a/api/acl.py +++ b/api/acl.py @@ -28,7 +28,7 @@ done. from django.conf import settings from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext as _ def _create_api_permission(): @@ -71,4 +71,5 @@ def can_view(user): 'codename': settings.API_PERMISSION_CODENAME } can = user.has_perm('%(app_label)s.%(codename)s' % kwargs) - return can, None if can else _("You cannot see this application.") + return can, None if can else _("You don't have the right to see this" + " application.") diff --git a/api/authentication.py b/api/authentication.py index cbc72b76..d426db24 100644 --- a/api/authentication.py +++ b/api/authentication.py @@ -46,6 +46,6 @@ class ExpiringTokenAuthentication(TokenAuthentication): ) utc_now = datetime.datetime.now(datetime.timezone.utc) if token.created < utc_now - token_duration: - raise exceptions.AuthenticationFailed(_('Token has expired')) + raise exceptions.AuthenticationFailed(_("The token has expired.")) return token.user, token diff --git a/api/locale/fr/LC_MESSAGES/django.po b/api/locale/fr/LC_MESSAGES/django.po new file mode 100644 index 00000000..f2d6755e --- /dev/null +++ b/api/locale/fr/LC_MESSAGES/django.po @@ -0,0 +1,40 @@ +# 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 +# quelques clics. +# +# Copyright © 2018 Maël Kervella +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +msgid "" +msgstr "" +"Project-Id-Version: 2.5\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-01-08 23:06+0100\n" +"PO-Revision-Date: 2019-01-07 01:37+0100\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" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: acl.py:74 +msgid "You don't have the right to see this application." +msgstr "Vous n'avez pas le droit de voir cette application." + +#: authentication.py:49 +msgid "The token has expired." +msgstr "Le jeton a expiré."