Skip to content

Update pagination wording to use trans_choice for optional pluralisat…#2554

Closed
iainco wants to merge 1 commit intolivewire:mainfrom
iainco:patch-1
Closed

Update pagination wording to use trans_choice for optional pluralisat…#2554
iainco wants to merge 1 commit intolivewire:mainfrom
iainco:patch-1

Conversation

@iainco
Copy link
Copy Markdown

@iainco iainco commented Apr 9, 2026

…ion of the word result

The scenario

This is really picky but something I noticed when working with the table component when paginating and there is only one result in the paginated collection.

The problem

When using pagination with a table like so:

<flux:table :paginate="$this->submissions">...</flux:table>

When the resultset size is 1, the pagination text shows as "Showing 1 to 1 of 1 results", when it should be "Showing 1 to 1 of 1 result".

The solution

This PR fixes the issue by using the trans_choice helper to choose "result" or "results" correctly.

Copy link
Copy Markdown
Member

@joshhanley joshhanley left a comment

Choose a reason for hiding this comment

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

@iainco thanks for the PR!

Not sure if the syntax is correct on this and believe it would currently be a breaking change. I think it should be used as:

trans_choice('results', $paginator->total())

That way anyone with "results" translated won't be impacted, but for anyone who wants trans_choice to work, would add a translation key like this:

// lang/en/messages.php
'results' => 'result|results',

We do try to keep our pagination in line with Laravel's as much as possible, and currently Laravel still has __('results'). Might be worth also submitting this change there? 😁https://github.com/laravel/framework/blob/13.x/src/Illuminate/Pagination/resources/views/tailwind.blade.php

@calebporzio
Copy link
Copy Markdown
Contributor

yeah lets just stay inline with laravel's paginator. if it changes there we can change it here. thanks for the PR!

@iainco
Copy link
Copy Markdown
Author

iainco commented Apr 10, 2026

Thank you @joshhanley and @calebporzio for your comments, I overlooked how the trans_choice helper works, apologies. Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants