PHPackages                             madbox-99/filament-translatable-model-labels - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. madbox-99/filament-translatable-model-labels

ActiveLibrary[Localization &amp; i18n](/categories/localization)

madbox-99/filament-translatable-model-labels
============================================

Resolve Filament Resource model labels (singular and plural) through Laravel translations.

v1.2.0(today)05↑2900%MITPHPPHP ^8.3CI passing

Since Jun 19Pushed todayCompare

[ Source](https://github.com/MadBox-99/filament-translatable-model-labels)[ Packagist](https://packagist.org/packages/madbox-99/filament-translatable-model-labels)[ RSS](/packages/madbox-99-filament-translatable-model-labels/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (4)Used By (0)

Filament Translatable Model Labels
==================================

[](#filament-translatable-model-labels)

Resolve Filament Resource model labels (singular **and** plural) — and therefore the navigation item and table heading — through Laravel's `__()` translation, keyed off the auto-derived model name. Define the translation once; every Resource picks it up without per-Resource overrides.

Installation
------------

[](#installation)

```
composer require madbox-99/filament-translatable-model-labels
```

Usage
-----

[](#usage)

Apply the trait to a shared base Resource so it is never repeated:

```
use Filament\Resources\Resource;
use MadBox99\FilamentTranslatableModelLabels\Concerns\TranslatesFilamentModelLabels;

abstract class BaseResource extends Resource
{
    use TranslatesFilamentModelLabels;
}
```

Or extend the provided base class:

```
use MadBox99\FilamentTranslatableModelLabels\TranslatableFilamentResource;

class IssueResource extends TranslatableFilamentResource
{
    protected static ?string $model = \App\Models\Issue::class;
}
```

Add the translations to your app's `lang/hu.json`:

```
{
    "issue": "probléma",
    "issues": "problémák"
}
```

Result: the create button reads "Új probléma", and the navigation item and table heading read "Problémák".

Automatic injection on `make:filament-resource`
-----------------------------------------------

[](#automatic-injection-on-makefilament-resource)

This works out of the box — **no configuration needed**. Once the package is installed, `php artisan make:filament-resource` adds the trait to every generated resource automatically. The generated class still extends the original Filament `Resource`; the package just adds the trait:

```
class OrderResource extends Resource
{
    use TranslatesFilamentModelLabels;

    protected static ?string $model = Order::class;
    // ...
}
```

The trait is a no-op when no translation exists (it returns the stock label), so it is harmless even on resources you don't translate.

### Turning it off

[](#turning-it-off)

If you'd rather add the trait manually, publish the config and disable it:

```
php artisan vendor:publish --tag=filament-translatable-model-labels-config
```

```
// config/filament-translatable-model-labels.php
return [
    'inject_trait_into_generated_resources' => false,
];
```

> Note: this hooks Filament's internal resource generator (`Filament\Commands\FileGenerators\Resources\ResourceClassGenerator`) via the container. It is a generation-time (dev) convenience with no runtime effect.

Retrofitting existing resources (Rector)
----------------------------------------

[](#retrofitting-existing-resources-rector)

The generator integration only affects **newly** generated resources. To add the trait to all of your **existing** resources in one pass, use the bundled [Rector](https://github.com/rectorphp/rector) rule.

Add it to your `rector.php`:

```
use MadBox99\FilamentTranslatableModelLabels\Rector\AddTranslatesFilamentModelLabelsTraitRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withPaths([__DIR__ . '/app'])
    ->withImportNames()
    ->withRules([
        AddTranslatesFilamentModelLabelsTraitRector::class,
    ]);
```

Then run it:

```
vendor/bin/rector
```

Every class that extends `Filament\Resources\Resource` and does not already use the trait gets `use TranslatesFilamentModelLabels;` added. Resources that already use it, and non-resource classes, are left untouched. Requires `rector/rector` in your project.

How it works
------------

[](#how-it-works)

- The singular label is `__()` — e.g. `Issue` → `__('issue')`.
- The plural label is `__(locale_has_pluralization() ? Str::plural() : )` — uses the pluralized form when the active locale supports pluralization, otherwise the singular form.
- An explicit `$modelLabel` / `$pluralModelLabel` on the Resource still wins.
- If no translation exists, `__()` returns the key unchanged, so untranslated locales behave exactly like stock Filament.

### Multi-word models

[](#multi-word-models)

The key is the humanised, lower-cased model name with spaces, e.g. `BlogPost`becomes `__('blog post')` / `__('blog posts')`:

```
{
    "blog post": "blogbejegyzés",
    "blog posts": "blogbejegyzések"
}
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance100

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/72586295?v=4)[Zoltán Tamás Szabó](/maintainers/MadBox-99)[@MadBox-99](https://github.com/MadBox-99)

---

Top Contributors

[![MadBox-99](https://avatars.githubusercontent.com/u/72586295?v=4)](https://github.com/MadBox-99 "MadBox-99 (10 commits)")

---

Tags

laraveli18ntranslationfilamentlabels

###  Code Quality

TestsPest

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/madbox-99-filament-translatable-model-labels/health.svg)

```
[![Health](https://phpackages.com/badges/madbox-99-filament-translatable-model-labels/health.svg)](https://phpackages.com/packages/madbox-99-filament-translatable-model-labels)
```

###  Alternatives

[kenepa/translation-manager

Manage your application's translation strings in Filament.

14792.4k2](/packages/kenepa-translation-manager)[abdulmajeed-jamaan/filament-translatable-tabs

Simplifying managing json based translation columns using tabs

3879.1k1](/packages/abdulmajeed-jamaan-filament-translatable-tabs)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[mominalzaraa/filament-localization

The first and only automatic Filament localization package with intelligent resource scanning, structured translation files, and comprehensive testing

101.6k](/packages/mominalzaraa-filament-localization)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
