Skip to content

Commit

Permalink
Query Total block: Reduce concatenation in the output text (#68150)
Browse files Browse the repository at this point in the history
Co-authored-by: sarthaknagoshe2002 <[email protected]>
Co-authored-by: swissspidy <[email protected]>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent 854b84d commit 5f22b7c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/block-library/src/query-total/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ function render_block_core_query_total( $attributes, $content, $block ) {
$range_text = sprintf(
/* translators: 1: Start index of posts, 2: Total number of posts */
__( 'Displaying %1$s of %2$s' ),
'<strong>' . $start . '</strong>',
'<strong>' . $max_rows . '</strong>'
$start,
$max_rows
);
} else {
$range_text = sprintf(
/* translators: 1: Start index of posts, 2: End index of posts, 3: Total number of posts */
__( 'Displaying %1$s – %2$s of %3$s' ),
'<strong>' . $start . '</strong>',
'<strong>' . $end . '</strong>',
'<strong>' . $max_rows . '</strong>'
$start,
$end,
$max_rows
);
}

Expand All @@ -61,10 +61,11 @@ function render_block_core_query_total( $attributes, $content, $block ) {

case 'total-results':
default:
$output = sprintf(
'<p><strong>%d</strong> %s</p>',
$max_rows,
_n( 'result found', 'results found', $max_rows )
// translators: %d: number of results.
$total_text = sprintf( _n( '%d result found', '%d results found', $max_rows ), $max_rows );
$output = sprintf(
'<p>%s</p>',
$total_text
);
break;
}
Expand Down

1 comment on commit 5f22b7c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 5f22b7c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12428934565
📝 Reported issues:

Please sign in to comment.