Filament: Customize Global Text with Laravel Translations

2025-01-24

In Filament, customizations often lead to modifying something in the underlying Laravel framework, instead of Filament itself. In this example, let's change the text for the modal when deleting a record. We will use Laravel translations for this.


Under the hood, this Modal uses the language string: __('filament-actions::modal.confirmation'), see the source.

We can change that message string in the language file.

So, we need to publish Filament translations, first. You can publish all language files:

php artisan vendor:publish --tag=filament-panels-translations

Or publish only translations from the packages you need to change. In this case, it would be an actions package:

php artisan vendor:publish --tag=filament-actions-translations

Now, we can change the language string.

lang/vendor/filament-actions/en/modal.php:

return [
 
'confirmation' => 'Are you sure you would like to do this?',
'confirmation' => 'Are you sure you want to delete these modules and all associated agents?',
 
// ...
 
];

And that's it. When you press delete, you will see your custom message.

A few of our Premium Examples: