Globally Translate all Components
By: Lara Zeus
- Published: 25 Mar 2024 Updated: 08 Aug 2026
make all Field or any components translatable
1Field::configureUsing(function (Field $column) {
2 $column->label(fn () => __(self::getLangFile() . $column->getName()));
3});
1public static function getLangFile(): string
2{
3 if (
4 method_exists(Livewire::current(), 'getResource')
5 && method_exists(Livewire::current()->getResource(), 'langFile')
6 ) {
7 /** @phpstan-ignore-next-line */
8 return Livewire::current()->getResource()::langFile() . '.';
9 }
10
11 return '';
12}
Related Tricks:
Disabling the cancel button on the filament editing form
Usability: Knowing whether or not the record was saved.
Bypass required when save as draft
Unrequire fields recursively when saving as draft
Copied to clipboard on suffix action
Custom copy action, click the icon to copy the content
Globally Translate all Components
make all Field or any components translatable
Implementing Authorization for Creating Options
How to Apply Authorization on Create Option Action for Select Field