Skip to content

apility/filament-localizable-resources

Repository files navigation

Filament Localizable Resources

Latest Version on Packagist GitHub Tests Action Status Total Downloads

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages