This package provides a re-usable trait for Filament Resources which adds support for localizing the resource labels.
You can install the package via composer:
composer require apility/filament-localizable-resources
namespace App\Filament\Resources;
use Apility\Filament\Concerns\HasLocalizableResourceLabels;
use Filament\Resources\Resource;
class ArticleResource extends Resource
{
use HasLocalizableResourceLabels;
// ...
}
The trait modifies the default methods for retrieving the resource labels to use the __()
helper function to translate the labels.
It will look for the translation key in the following format:
lang/<locale>
/resources.php
return [
// The resource slug is used as the translation key
'articles' => [
'model_label' => 'article|articles',
'navigation_label' => 'Articles', // Optional, defaults to model_label
'slug' => 'articles', // Optional, will use model_label as fallback
],
];
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.