Skip to content

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

Add translation to 'n items selected' text

dominik-zeglen95154c8f6e37
diff --git a/saleor/static/dashboard/js/components/bulk-actions.js b/saleor/static/dashboard/js/components/bulk-actions.js
index 3597b441cd..01037a1019 100644
--- a/saleor/static/dashboard/js/components/bulk-actions.js
+++ b/saleor/static/dashboard/js/components/bulk-actions.js
@@ -1,11 +1,19 @@
function updateCounterSelected () {
const count = $('.select-item:checked').length;
- const counterText = $('.data-table-header-action-selected-items');
- $('#counter').text(count);
+ const $counterTextNode = $('.data-table-header-action-selected-items');
+ let counterText;
+ switch (count) {
+ case 0: counterText = pgettext('bulk action select label zero', 'no items selected');
+ break;
+ case 1: counterText = pgettext('bulk action select label one', 'item selected');
+ break;
+ default: counterText = pgettext('bulk action select label multiple', 'items selected');
+ }
+ $counterTextNode.html(count ? `${count} ${counterText}` : counterText);
if (!count) {
- counterText.addClass('hide');
+ $counterTextNode.addClass('hide');
} else {
- counterText.removeClass('hide');
+ $counterTextNode.removeClass('hide');
}
}
diff --git a/templates/dashboard/product/list.html b/templates/dashboard/product/list.html
index 1e45fbc574..7ce9a1ea90 100644
--- a/templates/dashboard/product/list.html
+++ b/templates/dashboard/product/list.html
@@ -58,9 +58,7 @@
</div>
<div class="row">
<div class="col s12">
- <div class="data-table-header-action-selected-items col inline hide">
- <span id="counter">0</span> {% trans "item(s) selected" context "Dashboard bulk action summary" %}
- </div>
+ <div class="data-table-header-action-selected-items col inline hide"></div>
</div>
</div>
</div>