Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Pass counter to npgettext number and translations

Anna Siwik1ee4d6e47a21
diff --git a/saleor/dashboard/category/views.py b/saleor/dashboard/category/views.py
index 62ed0641da..d61c26a68e 100644
--- a/saleor/dashboard/category/views.py
+++ b/saleor/dashboard/category/views.py
@@ -22,11 +22,12 @@ def category_list(request):
categories = get_paginator_items(
category_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = category_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching category',
'Found %(counter)d matching categories',
- 'counter') % {'counter': category_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'categories': categories, 'filter': category_filter,
'is_empty': not category_filter.queryset.exists(),
@@ -95,11 +96,12 @@ def category_detail(request, pk):
categories = get_paginator_items(
category_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = category_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching subcategory',
'Found %(counter)d matching subcategories',
- 'counter') % {'counter': category_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {'categories': categories, 'path': path, 'root': root,
'filter': category_filter, 'summary_msg': summary_msg,
'is_empty': not category_filter.queryset.exists()}
diff --git a/saleor/dashboard/customer/views.py b/saleor/dashboard/customer/views.py
index 0b080cd68d..92dd850ad5 100644
--- a/saleor/dashboard/customer/views.py
+++ b/saleor/dashboard/customer/views.py
@@ -24,11 +24,12 @@ def customer_list(request):
customers = get_paginator_items(
customer_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = customer_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching customer',
'Found %(counter)d matching customers',
- 'counter') % {'counter': customer_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'customers': customers, 'filter': customer_filter,
'is_empty': not customer_filter.queryset.exists(),
diff --git a/saleor/dashboard/discount/views.py b/saleor/dashboard/discount/views.py
index fecae85b41..9e42d85cda 100644
--- a/saleor/dashboard/discount/views.py
+++ b/saleor/dashboard/discount/views.py
@@ -20,11 +20,12 @@ def sale_list(request):
sales = get_paginator_items(
sale_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = sale_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching sale',
'Found %(counter)d matching sales',
- 'counter') % {'counter': sale_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'sales': sales, 'filter': sale_filter,
'is_empty': not sale_filter.queryset.exists(),
@@ -72,11 +73,12 @@ def voucher_list(request):
vouchers = get_paginator_items(
voucher_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = voucher_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching voucher',
'Found %(counter)d matching vouchers',
- 'counter') % {'counter': voucher_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'vouchers': vouchers, 'filter': voucher_filter,
'is_empty': not voucher_filter.queryset.exists(),
diff --git a/saleor/dashboard/group/views.py b/saleor/dashboard/group/views.py
index 7457ecfc02..aa08b61eb3 100644
--- a/saleor/dashboard/group/views.py
+++ b/saleor/dashboard/group/views.py
@@ -22,11 +22,12 @@ def group_list(request):
for group in group_filter.qs]
groups = get_paginator_items(
groups, settings.DASHBOARD_PAGINATE_BY, request.GET.get('page'))
+ counter = group_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching group',
'Found %(counter)d matching groups',
- 'counter') % {'counter': group_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'groups': groups, 'filter': group_filter,
'is_empty': not group_filter.queryset.exists(),
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.py
index eefff7771a..27070b1c2e 100644
--- a/saleor/dashboard/order/views.py
+++ b/saleor/dashboard/order/views.py
@@ -37,11 +37,12 @@ def order_list(request):
orders = get_paginator_items(
order_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = order_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
- 'Found %(counter)d matching product',
- 'Found %(counter)d matching products',
- 'counter') % {'counter': order_filter.qs.count()}
+ 'Found %(counter)d matching order',
+ 'Found %(counter)d matching orders',
+ number=counter) % {'counter': counter}
ctx = {
'orders': orders, 'filter': order_filter,
'is_empty': not order_filter.queryset.exists(),
diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.py
index b0555c1d0a..d0e09416d8 100644
--- a/saleor/dashboard/product/views.py
+++ b/saleor/dashboard/product/views.py
@@ -34,11 +34,12 @@ def product_class_list(request):
classes = get_paginator_items(
class_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = class_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching product type',
'Found %(counter)d matching product types',
- 'counter') % {'counter': class_filter.qs.count()}
+ number=counter) % {'counter': counter}
classes.object_list = [
(pc.pk, pc.name, pc.has_variants, pc.product_attributes.all(),
pc.variant_attributes.all())
@@ -123,11 +124,12 @@ def product_list(request):
products = get_paginator_items(
product_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = product_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching product',
'Found %(counter)d matching products',
- 'counter') % {'counter': product_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'bulk_action_form': forms.ProductBulkUpdate(),
'products': products, 'product_classes': product_classes,
@@ -508,11 +510,12 @@ def attribute_list(request):
for attribute in attribute_filter.qs]
attributes = get_paginator_items(
attributes, settings.DASHBOARD_PAGINATE_BY, request.GET.get('page'))
+ counter = attribute_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching attribute',
'Found %(counter)d matching attributes',
- 'counter') % {'counter': attribute_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'attributes': attributes, 'filter': attribute_filter,
'is_empty': not attribute_filter.queryset.exists(),
diff --git a/saleor/dashboard/shipping/views.py b/saleor/dashboard/shipping/views.py
index c3594c9d3f..8193de7399 100644
--- a/saleor/dashboard/shipping/views.py
+++ b/saleor/dashboard/shipping/views.py
@@ -22,11 +22,12 @@ def shipping_method_list(request):
methods = get_paginator_items(
shipping_method_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = shipping_method_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching shipping method',
'Found %(counter)d matching shipping methods',
- 'counter') % {'counter': shipping_method_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'shipping_methods': methods, 'filter': shipping_method_filter,
'is_empty': not shipping_method_filter.queryset.exists(),
diff --git a/saleor/dashboard/staff/views.py b/saleor/dashboard/staff/views.py
index 56c936abb9..e64383db94 100644
--- a/saleor/dashboard/staff/views.py
+++ b/saleor/dashboard/staff/views.py
@@ -23,11 +23,12 @@ def staff_list(request):
staff_members = get_paginator_items(
staff_filter.qs, settings.DASHBOARD_PAGINATE_BY,
request.GET.get('page'))
+ counter = staff_filter.qs.count()
summary_msg = npgettext(
'Filter set results summary',
'Found %(counter)d matching staff member',
'Found %(counter)d matching staff members',
- 'counter') % {'counter': staff_filter.qs.count()}
+ number=counter) % {'counter': counter}
ctx = {
'staff': staff_members, 'filter': staff_filter,
'is_empty': not staff_filter.queryset.exists(),