apility / filament-localizable-resources
This package provides a re-usable trait for Filament Resources which adds support for localizing the resource labels.
Fund package maintenance!
Apility
Requires
- php: ^8.1
- illuminate/contracts: ^10.0
- illuminate/support: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-29 22:44:26 UTC
README
This package provides a re-usable trait for Filament Resources which adds support for localizing the resource labels.
Installation
You can install the package via composer:
composer require apility/filament-localizable-resources
Usage
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 ], ];
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.