PHPackages                             filament/spatie-laravel-translatable-plugin - 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. [Admin Panels](/categories/admin)
4. /
5. filament/spatie-laravel-translatable-plugin

Abandoned → [lara-zeus/spatie-translatable](/?search=lara-zeus%2Fspatie-translatable)Library[Admin Panels](/categories/admin)

filament/spatie-laravel-translatable-plugin
===========================================

Filament support for `spatie/laravel-translatable`.

v3.3.54(3w ago)1001.5M↓38.8%4820MITPHPPHP ^8.1

Since Nov 27Pushed 3w ago5 watchersCompare

[ Source](https://github.com/filamentphp/spatie-laravel-translatable-plugin)[ Packagist](https://packagist.org/packages/filament/spatie-laravel-translatable-plugin)[ Docs](https://github.com/filamentphp/filament)[ RSS](/packages/filament-spatie-laravel-translatable-plugin/feed)WikiDiscussions 3.x Synced 3d ago

READMEChangelogDependencies (9)Versions (922)Used By (20)

Important

This plugin is now maintained by Lara Zeus:

Filament Spatie Translatable Plugin
===================================

[](#filament-spatie-translatable-plugin)

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

[](#installation)

Install the plugin with Composer:

```
composer require filament/spatie-laravel-translatable-plugin:"^3.2" -W
```

Adding the plugin to a panel
----------------------------

[](#adding-the-plugin-to-a-panel)

To add a plugin to a panel, you must include it in the configuration file using the `plugin()` method:

```
use Filament\SpatieLaravelTranslatablePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(SpatieLaravelTranslatablePlugin::make());
}
```

Setting the default translatable locales
----------------------------------------

[](#setting-the-default-translatable-locales)

To set up the locales that can be used to translate content, you can pass an array of locales to the `defaultLocales()` plugin method:

```
use Filament\SpatieLaravelTranslatablePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(
            SpatieLaravelTranslatablePlugin::make()
                ->defaultLocales(['en', 'es']),
        );
}
```

Preparing your model class
--------------------------

[](#preparing-your-model-class)

You need to make your model translatable. You can read how to do this in [Spatie's documentation](https://spatie.be/docs/laravel-translatable/installation-setup#content-making-a-model-translatable).

Preparing your resource class
-----------------------------

[](#preparing-your-resource-class)

You must apply the `Filament\Resources\Concerns\Translatable` trait to your resource class:

```
use Filament\Resources\Concerns\Translatable;
use Filament\Resources\Resource;

class BlogPostResource extends Resource
{
    use Translatable;

    // ...
}
```

Making resource pages translatable
----------------------------------

[](#making-resource-pages-translatable)

After [preparing your resource class](#preparing-your-resource-class), you must make each of your resource's pages translatable too. You can find your resource's pages in the `Pages` directory of each resource folder. To prepare a page, you must apply the corresponding `Translatable` trait to it, and install a `LocaleSwitcher` header action:

```
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListBlogPosts extends ListRecords
{
    use ListRecords\Concerns\Translatable;

    protected function getHeaderActions(): array
    {
        return [
            Actions\LocaleSwitcher::make(),
            // ...
        ];
    }

    // ...
}
```

```
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateBlogPost extends CreateRecord
{
    use CreateRecord\Concerns\Translatable;

    protected function getHeaderActions(): array
    {
        return [
            Actions\LocaleSwitcher::make(),
            // ...
        ];
    }

    // ...
}
```

```
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditBlogPost extends EditRecord
{
    use EditRecord\Concerns\Translatable;

    protected function getHeaderActions(): array
    {
        return [
            Actions\LocaleSwitcher::make(),
            // ...
        ];
    }

    // ...
}
```

And if you have a `ViewRecord` page for your resource:

```
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;

class ViewBlogPost extends ViewRecord
{
    use ViewRecord\Concerns\Translatable;

    protected function getHeaderActions(): array
    {
        return [
            Actions\LocaleSwitcher::make(),
            // ...
        ];
    }

    // ...
}
```

If you're using a simple resource, you can make the `ManageRecords` page translatable instead:

```
use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;

class ManageBlogPosts extends ListRecords
{
    use ManageRecords\Concerns\Translatable;

    protected function getHeaderActions(): array
    {
        return [
            Actions\LocaleSwitcher::make(),
            // ...
        ];
    }

    // ...
}
```

### Setting the translatable locales for a particular resource

[](#setting-the-translatable-locales-for-a-particular-resource)

By default, the translatable locales can be [set globally for all resources in the plugin configuration](#setting-the-default-translatable-locales). Alternatively, you can customize the translatable locales for a particular resource by overriding the `getTranslatableLocales()` method in your resource class:

```
use Filament\Resources\Concerns\Translatable;
use Filament\Resources\Resource;

class BlogPostResource extends Resource
{
    use Translatable;

    // ...

    public static function getTranslatableLocales(): array
    {
        return ['en', 'fr'];
    }
}
```

Translating relation managers
-----------------------------

[](#translating-relation-managers)

First, you must apply the `Filament\Resources\RelationManagers\Concerns\Translatable` trait to the relation manager class:

```
use Filament\Resources\RelationManagers\Concerns\Translatable;
use Filament\Resources\RelationManagers\RelationManager;

class BlogPostsRelationManager extends RelationManager
{
    use Translatable;

    // ...
}
```

Now, you can add a new `LocaleSwitcher` action to the header of the relation manager's `table()`:

```
use Filament\Tables;
use Filament\Tables\Table;

public function table(Table $table): Table
{
    return $table
        ->columns([
            // ...
        ])
        ->headerActions([
            // ...
            Tables\Actions\LocaleSwitcher::make(),
        ]);
}
```

### Inheriting the relation manager's active locale from the resource page

[](#inheriting-the-relation-managers-active-locale-from-the-resource-page)

If you wish to reactively inherit the locale of the `Translatable` resource page that the relation manager is being displayed on, you can override the `$activeLocale` property and add Livewire's `Reactive` attribute to it:

```
use Filament\Resources\RelationManagers\Concerns\Translatable;
use Filament\Resources\RelationManagers\RelationManager;
use Livewire\Attributes\Reactive;

class BlogPostsRelationManager extends RelationManager
{
    use Translatable;

    #[Reactive]
    public ?string $activeLocale = null;

    // ...
}
```

If you do this, you no longer need a `LocaleSwitcher` action in the `table()`.

### Setting the translatable locales for a particular relation manager

[](#setting-the-translatable-locales-for-a-particular-relation-manager)

By default, the translatable locales can be [set globally for all relation managers in the plugin configuration](#setting-the-default-translatable-locales). Alternatively, you can customize the translatable locales for a particular relation manager by overriding the `getTranslatableLocales()` method in your relation manager class:

```
use Filament\Resources\RelationManagers\Concerns\Translatable;
use Filament\Resources\RelationManagers\RelationManager;

class BlogPostsRelationManager extends RelationManager
{
    use Translatable;

    // ...

    public function getTranslatableLocales(): array
    {
        return ['en', 'fr'];
    }
}
```

Publishing translations
-----------------------

[](#publishing-translations)

If you wish to translate the package, you may publish the language files using:

```
php artisan vendor:publish --tag=filament-spatie-laravel-translatable-plugin-translations
```

###  Health Score

69

—

FairBetter than 100% of packages

Maintenance95

Actively maintained with recent releases

Popularity57

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity79

Established project with proven stability

 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 ~2 days

Recently: every ~76 days

Total

921

Last Release

22d ago

Major Versions

v2.16.63 → v3.0.0-alpha82023-01-22

v2.16.66 → v3.0.0-alpha232023-01-29

v2.17.12 → v3.0.0-alpha512023-02-16

v2.17.22 → v3.0.0-alpha792023-04-16

v2.17.35 → v3.0.0-alpha892023-05-09

PHP version history (2 changes)v2.4.50PHP ^8.0

v3.0.0-alpha102PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d5513b5defa6f680b8db229a305abf62d4e70f3e943b0da57dd5b303095c50c6?d=identicon)[DanHarrin](/maintainers/DanHarrin)

---

Top Contributors

[![danharrin](https://avatars.githubusercontent.com/u/41773797?v=4)](https://github.com/danharrin "danharrin (123 commits)")

### Embed Badge

![Health badge](/badges/filament-spatie-laravel-translatable-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/filament-spatie-laravel-translatable-plugin/health.svg)](https://phpackages.com/packages/filament-spatie-laravel-translatable-plugin)
```

###  Alternatives

[filament/filament

A collection of full-stack components for accelerated Laravel app development.

3829.6M3.7k](/packages/filament-filament)[filament/spatie-laravel-media-library-plugin

Filament support for `spatie/laravel-medialibrary`.

1806.0M195](/packages/filament-spatie-laravel-media-library-plugin)[filament/forms

Easily add beautiful forms to any Livewire component.

4831.0M418](/packages/filament-forms)[filament/infolists

Easily add beautiful read-only infolists to any Livewire component.

1327.7M65](/packages/filament-infolists)[filament/widgets

Easily add beautiful dashboard widgets to any Livewire component.

1426.9M40](/packages/filament-widgets)[filament/actions

Easily add beautiful action modals to any Livewire component.

1327.7M79](/packages/filament-actions)

PHPackages © 2026

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