From 07ce7bd8a77d76a4fab23d095f4722cc854c3396 Mon Sep 17 00:00:00 2001 From: Laouen Fernet Date: Sat, 16 Nov 2019 14:03:08 +0000 Subject: [PATCH] Mark strings for translation in logs --- logs/acl.py | 3 ++- logs/templates/logs/aff_summary.html | 2 +- logs/views.py | 38 ++++++++++++++-------------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/logs/acl.py b/logs/acl.py index f6be8183..42000ea8 100644 --- a/logs/acl.py +++ b/logs/acl.py @@ -41,6 +41,7 @@ def can_view(user): can = user.has_module_perms("admin") return ( can, - None if can else _("You don't have the right to view this" " application."), + None if can else _("You don't have the right to view this" + " application."), "admin", ) diff --git a/logs/templates/logs/aff_summary.html b/logs/templates/logs/aff_summary.html index 7205bc6a..31834a2d 100644 --- a/logs/templates/logs/aff_summary.html +++ b/logs/templates/logs/aff_summary.html @@ -113,7 +113,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% blocktrans with username=v.username number=v.version.object.number name=v.version.object.name %}{{ username }} has sold {{ number }}x {{ name }}{% endblocktrans %} {% with invoice=v.version.object.facture %} {% if invoice|is_facture %} - {% trans " to" %} + {% trans "to" %} {{ v.version.object.facture.facture.user.get_username }} {% if v.version.object.iscotisation %} ({% blocktrans with duration=v.version.object.duration %}+{{ duration }} months{% endblocktrans %}) diff --git a/logs/views.py b/logs/views.py index be71f7cc..7c509134 100644 --- a/logs/views.py +++ b/logs/views.py @@ -241,7 +241,7 @@ def stats_general(request): Club.objects.filter(state=Club.STATE_ARCHIVE).count(), ], "full_archive_users": [ - _("Full Archived users"), + _("Fully archived users"), User.objects.filter(state=User.STATE_FULL_ARCHIVE).count(), ( Adherent.objects.filter( @@ -321,7 +321,7 @@ def stats_general(request): _("Total number of IP addresses"), _("Number of assigned IP addresses"), _("Number of IP address assigned to an activated machine"), - _("Number of nonassigned IP addresses"), + _("Number of unassigned IP addresses"), ], ip_dict, # Data already prepared ], @@ -336,7 +336,7 @@ def stats_models(request): nombre d'users, d'écoles, de droits, de bannissements, de factures, de ventes, de banque, de machines, etc""" stats = { - _("Users"): { + _("Users (members and clubs)"): { "users": [User._meta.verbose_name, User.objects.count()], "adherents": [Adherent._meta.verbose_name, Adherent.objects.count()], "clubs": [Club._meta.verbose_name, Club.objects.count()], @@ -350,14 +350,14 @@ def stats_models(request): "ban": [Ban._meta.verbose_name, Ban.objects.count()], "whitelist": [Whitelist._meta.verbose_name, Whitelist.objects.count()], }, - _("Subscriptions"): { + Cotisation._meta.verbose_name_plural.title(): { "factures": [Facture._meta.verbose_name, Facture.objects.count()], "vente": [Vente._meta.verbose_name, Vente.objects.count()], "cotisation": [Cotisation._meta.verbose_name, Cotisation.objects.count()], "article": [Article._meta.verbose_name, Article.objects.count()], "banque": [Banque._meta.verbose_name, Banque.objects.count()], }, - _("Machines"): { + Machine._meta.verbose_name_plural.title(): { "machine": [Machine._meta.verbose_name, Machine.objects.count()], "typemachine": [ MachineType._meta.verbose_name, @@ -412,31 +412,31 @@ def stats_users(request): de moyens de paiements par user, de banque par user, de bannissement par user, etc""" stats = { - _("User"): { - _("Machines"): User.objects.annotate(num=Count("machine")).order_by("-num")[ + User._meta.verbose_name: { + Machine._meta.verbose_name_plural: User.objects.annotate(num=Count("machine")).order_by("-num")[ :10 ], - _("Invoice"): User.objects.annotate(num=Count("facture")).order_by("-num")[ + Facture._meta.verbose_name_plural: User.objects.annotate(num=Count("facture")).order_by("-num")[ :10 ], - _("Ban"): User.objects.annotate(num=Count("ban")).order_by("-num")[:10], - _("Whitelist"): User.objects.annotate(num=Count("whitelist")).order_by( + Ban._meta.verbose_name_plural: User.objects.annotate(num=Count("ban")).order_by("-num")[:10], + Whitelist._meta.verbose_name_plural: User.objects.annotate(num=Count("whitelist")).order_by( "-num" )[:10], - _("Rights"): User.objects.annotate(num=Count("groups")).order_by("-num")[ + _("rights"): User.objects.annotate(num=Count("groups")).order_by("-num")[ :10 ], }, - _("School"): { - _("User"): School.objects.annotate(num=Count("user")).order_by("-num")[:10] + School._meta.verbose_name: { + User._meta.verbose_name_plural: School.objects.annotate(num=Count("user")).order_by("-num")[:10] }, - _("Payment method"): { - _("User"): Paiement.objects.annotate(num=Count("facture")).order_by("-num")[ + Paiement._meta.verbose_name: { + User._meta.verbose_name_plural: Paiement.objects.annotate(num=Count("facture")).order_by("-num")[ :10 ] }, - _("Bank"): { - _("User"): Banque.objects.annotate(num=Count("facture")).order_by("-num")[ + Banque._meta.verbose_name: { + User._meta.verbose_name_plural: Banque.objects.annotate(num=Count("facture")).order_by("-num")[ :10 ] }, @@ -451,8 +451,8 @@ def stats_actions(request): utilisateurs. Affiche le nombre de modifications aggrégées par utilisateurs""" stats = { - _("User"): { - _("Action"): User.objects.annotate(num=Count("revision")).order_by("-num")[ + User._meta.verbose_name: { + _("actions"): User.objects.annotate(num=Count("revision")).order_by("-num")[ :40 ] }