From 7ae2f75b45e18e66ab662e55b66654034bc75cb3 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 24 Jan 2022 14:14:29 +0100 Subject: [PATCH] api: add translation context to statistics choices (#61000) --- chrono/api/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chrono/api/views.py b/chrono/api/views.py index 11ec76c1..748d284d 100644 --- a/chrono/api/views.py +++ b/chrono/api/views.py @@ -34,6 +34,7 @@ from django.utils.formats import date_format from django.utils.timezone import localtime, make_aware, now from django.utils.translation import gettext from django.utils.translation import gettext_noop as N_ +from django.utils.translation import pgettext from django.utils.translation import ugettext_lazy as _ from django_filters import rest_framework as filters from rest_framework import permissions @@ -2417,11 +2418,11 @@ class StatisticsList(APIView): def get(self, request, *args, **kwargs): categories = Category.objects.all() - category_options = [{'id': '_all', 'label': _('All')}] + [ + category_options = [{'id': '_all', 'label': pgettext('categories', 'All')}] + [ {'id': x.slug, 'label': x.label} for x in categories ] agendas = Agenda.objects.all() - agenda_options = [{'id': '_all', 'label': _('All')}] + [ + agenda_options = [{'id': '_all', 'label': pgettext('agendas', 'All')}] + [ {'id': x.slug, 'label': x.label} for x in agendas ] booking_check_filters = set() -- 2.30.2