Search code examples
laravelbootstrap-5laravel-9

Localize text of Bootstrap 5 paginator links


When setting \Illuminate\Pagination\Paginator::useBootstrapFive(); at the \App\Providers\AppServiceProvider class, the links() method generates the following text at the bottom left of the page:

Showing 1 to 10 of 13 results

How can we translate it into other languages?


Solution

  • Solution

    Add these translations:

    1. 'Showing'
    2. 'to'
    3. 'of'
    4. 'results'

    Addendum

    To customize the pagination views:

    Customizing The Pagination View

    However, the easiest way to customize the pagination views is by exporting them to your resources/views/vendor directory using the vendor:publish command:

    php artisan vendor:publish --tag=laravel-pagination

    This command will place the views in your application's resources/views/vendor/pagination directory. The tailwind.blade.php file within this directory corresponds to the default pagination view. You may edit this file to modify the pagination HTML.


    resources
    |
    └───views
        |
        └───vendor
            |
            │
            └───pagination
                    bootstrap-4.blade.php
                    bootstrap-5.blade.php
                    default.blade.php
                    semantic-ui.blade.php
                    simple-bootstrap-4.blade.php
                    simple-bootstrap-5.blade.php
                    simple-default.blade.php
                    simple-tailwind.blade.php
                    tailwind.blade.php