Skip to content

Commit

Permalink
improve count labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Aug 9, 2024
1 parent cdf60fa commit 6b10de1
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions packages/dataviews/src/components/dataviews-bulk-actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,22 @@ function renderFooterContent< Item >(
onChangeSelection: SetSelection,
selectableItems: Item[]
) {
const countToShow =
const message =
selectedItems.length > 0
? selectedItems.length
: selectableItems.length;
? sprintf(
/* translators: %d: number of items. */
_n(
'%d Item selected',
'%d Items selected',
selectedItems.length
),
selectedItems.length
)
: sprintf(
/* translators: %d: number of items. */
_n( '%d Item', '%d Items', data.length ),
data.length
);
return (
<HStack
expanded={ false }
Expand All @@ -210,11 +222,7 @@ function renderFooterContent< Item >(
getItemId={ getItemId }
/>
<span className="dataviews-bulk-actions-footer__item-count">
{ sprintf(
/* translators: %d: number of items. */
_n( '%d Item', '%d Items', countToShow ),
countToShow
) }
{ message }
</span>
<HStack
className="dataviews-bulk-actions-footer__action-buttons"
Expand Down

0 comments on commit 6b10de1

Please sign in to comment.