From 06b1c9aa4068510bd75747ae9060d4a5fd072bb1 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Wed, 6 Jul 2022 09:48:12 +0200 Subject: [PATCH] Handle plural (and 0) on orders selection component --- app/views/spree/admin/orders/index.html.haml | 8 ++++++-- config/locales/en.yml | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/views/spree/admin/orders/index.html.haml b/app/views/spree/admin/orders/index.html.haml index 58adef82be..bfec263cca 100644 --- a/app/views/spree/admin/orders/index.html.haml +++ b/app/views/spree/admin/orders/index.html.haml @@ -24,8 +24,12 @@ - if Spree::Config[:enable_invoices?] .ofn-drop-down-with-prepend .ofn-drop-down-prepend{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"} - {{ selected_orders.length }} - =t('.selected') + %span{"ng-show" => "selected_orders.length == 0"} + = t('.selected.zero') + %span{"ng-show" => "selected_orders.length == 1"} + = t('.selected.one') + %span{"ng-show" => "selected_orders.length > 1"} + = t('.selected.many', count: "{{ selected_orders.length }}") .ofn-drop-down{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"} %span{ :class => 'icon-reorder' } ="#{t('admin.actions')}".html_safe diff --git a/config/locales/en.yml b/config/locales/en.yml index d7a2282288..36bf1ecccb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3774,7 +3774,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using results_found: "%{number} Results found." viewing: "Viewing %{start} to %{end}." print_invoices: "Print Invoices" - selected: selected + selected: + zero: "No order selected" + one: "1 order selected" + many: "%{count} orders selected" sortable_header: payment_state: "Payment State" shipment_state: "Shipment State"