PHPackages                             webard/filament-translatable - 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. webard/filament-translatable

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

webard/filament-translatable
============================

Highly customizable Translation component for Filament PHP.

v3.3.1(3mo ago)7752—5.6%1MITPHPPHP ^8.3CI passing

Since Aug 12Pushed 1mo agoCompare

[ Source](https://github.com/webard/filament-translatable)[ Packagist](https://packagist.org/packages/webard/filament-translatable)[ Docs](https://github.com/webard/filament-translatable)[ RSS](/packages/webard-filament-translatable/feed)WikiDiscussions v3 Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (18)Used By (0)

Filament Translatable
=====================

[](#filament-translatable)

 [ ![FILAMENT 3.x](https://camo.githubusercontent.com/346fbf187afb5a0f0c9df87435c75f75a07a8e7c675fdc06e848f8921fb0cc7f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d332e782d4542423330343f7374796c653d666f722d7468652d6261646765) ](https://filamentphp.com/docs/3.x/introduction/overview) [ ![FILAMENT 4.x](https://camo.githubusercontent.com/13befbe0cffd101b2484ce1cdd985dabcddcbf1176d17a675674d53af99cfdbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d342e782d4542423330343f7374796c653d666f722d7468652d6261646765) ](https://filamentphp.com/docs/4.x/introduction/overview) [ ![FILAMENT 5.x](https://camo.githubusercontent.com/3ec960aa304b803da9f1192f01e82da976a3d220ea85931fec930003e0532c77/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d352e782d4542423330343f7374796c653d666f722d7468652d6261646765) ](https://filamentphp.com/docs/5.x/introduction/overview) [ ![Packagist](https://camo.githubusercontent.com/aaf71beed07f0c98f2bd56464f433638b988debadd6f431588fe2f7977ed595c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7765626172642f66696c616d656e742d7472616e736c617461626c652e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374) ](https://packagist.org/packages/webard/filament-translatable) [ ![Tests Passing](https://camo.githubusercontent.com/33e748f214a127c1f71ac4fad6d47d6017c4141a1608faf7e80ab353fa171346/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7765626172642f66696c616d656e742d7472616e736c617461626c652f72756e2d74657374732e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d7465737473) ](https://github.com/webard/filament-translatable/actions?query=workflow%3Arun-tests+branch%3Av3) [ ![PHPStan Passing](https://camo.githubusercontent.com/32c6218aecb4e645f25c2321f2f6c43d30d907acc9ebf233512360cba7891f7f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7765626172642f66696c616d656e742d7472616e736c617461626c652f7068707374616e2e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d7068707374616e) ](https://github.com/webard/filament-translatable/actions?query=workflow%3Aphpstan+branch%3Av3) [ ![Rector Passing](https://camo.githubusercontent.com/bfaf7948295bdf328d9c15da008f6ff9fdee21db4b8dd13c00d9a28e909fdfa1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7765626172642f66696c616d656e742d7472616e736c617461626c652f726563746f722e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d726563746f72) ](https://github.com/webard/filament-translatable/actions?query=workflow%3Arector+branch%3Av3) [ ![Downloads](https://camo.githubusercontent.com/ddc0f0d53235ebb97799bb91c27a6eb9a7bfa41ce761a0b12ec5c09a8a998aba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7765626172642f66696c616d656e742d7472616e736c617461626c652e7376673f7374796c653d666f722d7468652d6261646765) ](https://packagist.org/packages/webard/filament-translatable)

**Filament Translatable** is a flexible package that provides a complete solution for managing multilingual content in [Filament](https://filamentphp.com) admin panels. It allows you to easily create translatable form fields with an intuitive tabbed interface, supporting multiple locales and translation packages.

Key Features
------------

[](#key-features)

- **Multiple translation backends** — supports both [spatie/laravel-translatable](https://github.com/spatie/laravel-translatable) and [astrotomic/laravel-translatable](https://github.com/astrotomic/laravel-translatable)
- **Two usage modes** — use the quick `translatable()` macro on any field, or the full `Translations` component for advanced scenarios
- **Locale tabs with flags** — display translations in horizontal or vertical tabs with optional country flag icons
- **Flexible locale configuration** — define locales globally or per-component, with custom labels
- **Required locale validation** — mark fields as required for specific locales or only for the default locale
- **Field decoration per locale** — customize field appearance (prefix, suffix, etc.) for each language
- **Custom actions per tab** — add custom Filament actions to each locale tab with access to the current locale
- **Exclude fields from translation** — selectively exclude specific fields from the translation process
- **Prefix/suffix locale labels** — optionally add locale indicators to field labels

   ![translatable component](https://raw.githubusercontent.com/webard/filament-translatable/refs/heads/v3/screenshots/component-light.png)Installation
------------

[](#installation)

Filament VersionFilament Translate Field Version3.x2.x4.x3.x5.x3.xYou can install the package via composer:

```
composer require webard/filament-translatable
```

Publish the assets:

```
php artisan filament:assets
```

Configuration
-------------

[](#configuration)

### With `spatie/laravel-translatable`

[](#with-spatielaravel-translatable)

The [Spatie](https://github.com/spatie/laravel-translatable) package is the default translation backend. Follow the instructions in the [Spatie documentation](https://github.com/spatie/laravel-translatable/?tab=readme-ov-file#a-trait-to-make-eloquent-models-translatable) to properly configure your models.

### With `astrotomic/laravel-translatable`

[](#with-astrotomiclaravel-translatable)

The [Astrotomic](https://github.com/astrotomic/laravel-translatable) package is an alternative translation backend.

Follow the [Astrotomic documentation](https://docs.astrotomic.info/laravel-translatable/installation#models) to configure your models. However, instead of using the `Translatable` trait from the Astrotomic package, use `Webard\FilamentTranslatable\Traits\AstrotomicTranslatable`.

When using the Astrotomic package, configure the plugin to use Astrotomic mode:

```
use Webard\FilamentTranslatable\Enums\TranslationMode;

FilamentTranslatablePlugin::make()
    ->translationMode(TranslationMode::Astrotomic)
```

You can also configure `translationMode` per component:

```
 Translations::make('translations')
    ->translationMode(TranslationMode::Astrotomic)
```

Or per field:

```
 TextInput::make('name')
    ->translatable()
    ->translationMode(TranslationMode::Astrotomic)
```

Setup
-----

[](#setup)

```
use Webard\FilamentTranslatable\FilamentTranslatablePlugin;

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

### Setting translatable locales

[](#setting-translatable-locales)

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

```
FilamentTranslatablePlugin::make()
     ->locales(['en', 'pl', 'fr']),
```

You can set locale labels using key =&gt; value array:

```
FilamentTranslatablePlugin::make()
    ->locales([
        'pl' => __('Polish'),
        'en' => __('English')
    ])
```

Also, you can pass a Closure:

```
FilamentTranslatablePlugin::make()
    ->locales(fn () => Language::pluck('code', 'name'))
```

### Setting default locale

[](#setting-default-locale)

You can set the default locale using the `defaultLocale()` method:

```
FilamentTranslatablePlugin::make()
     ->defaultLocale('pl'),
```

### Enable or disable flags in locale labels

[](#enable-or-disable-flags-in-locale-labels)

You can enable or disable flags in locale labels (disabled by default):

```
FilamentTranslatablePlugin::make()
    ->displayFlagsInLocaleLabels(true)
```

### Setting flag width

[](#setting-flag-width)

You can set the flag width using:

```
FilamentTranslatablePlugin::make()
    ->flagWidth('24px')
```

### Enable or disable names in locale labels

[](#enable-or-disable-names-in-locale-labels)

You can enable or disable locale names in locale labels (enabled by default):

```
FilamentTranslatablePlugin::make()
    ->displayNamesInLocaleLabels(false)
```

Otherwise, the `app.fallback_locale` config value will be used.

Usage
-----

[](#usage)

### `translatable()` macro

[](#translatable-macro)

The `translatable()` macro allows you to quickly convert any [form field](https://filamentphp.com/docs/4.x/forms/fields/getting-started) into a multilingual field that supports translations for each configured locale.

```
use Filament\Forms\Components\TextInput;

TextInput::make('name')
    ->translatable()
```

   ![translatable macro](https://raw.githubusercontent.com/webard/filament-translatable/refs/heads/v3/screenshots/macro-light.png)#### Marking a field as required for a specific locale

[](#marking-a-field-as-required-for-a-specific-locale)

You can make a field required only for specific locales. In this example, the "name" field will only be required for the English language:

```
use Filament\Forms\Components\TextInput;

TextInput::make('name')
    ->requiredLocale('en')
    ->translatable()
```

#### Marking a field as required for the default locale

[](#marking-a-field-as-required-for-the-default-locale)

You can make a field required only for the default locale. The default locale is determined by the `defaultLocale()` plugin setting or the `app.fallback_locale` config value:

```
use Filament\Forms\Components\TextInput;

TextInput::make('name')
    ->requiredDefaultLocale()
    ->translatable()
```

#### Decorating language-specific fields

[](#decorating-language-specific-fields)

You can customize the appearance of fields for specific locales using the `decorateTranslationField()` method. This is useful for adding locale-specific prefixes, suffixes, or other modifications:

```
use Filament\Forms\Components\TextInput;

TextInput::make('price')
    ->decorateTranslationField('pl', fn (TextInput $field) => $field->suffix('PLN'))
    ->decorateTranslationField('en', fn (TextInput $field) => $field->prefix('USD'))
    ->translatable()
```

#### Customizing `Translations` component

[](#customizing-translations-component)

After using the `translatable()` method, the context of the field is switched to the `Translations` component, so you can use any method that belongs to the component.

```
use Filament\Forms\Components\TextInput;

TextInput::make('price')
    ->requiredDefaultLocale()
    ->translatable() // Here context is switched from TextInput to Translations component
    ->vertical()
    ->displayFlagsInLocaleLabels(true)
    ->displayNamesInLocaleLabels(false)
    ->flagWidth('48px')
```

   ![translatable custom macro](https://raw.githubusercontent.com/webard/filament-translatable/refs/heads/v3/screenshots/macro2-light.png)Caution

Be sure to set field-specific methods like `required()` or `requiredDefaultLocale()` **before** calling the `translatable()` method.

### `Translations` component

[](#translations-component)

The `Translations` component provides a more powerful way to configure multiple [form fields](https://filamentphp.com/docs/4.x/forms/fields/getting-started) for multilingual support. It displays translations in a tabbed interface, with each tab representing a different locale.

```
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make('translations') // name is required to properly handle actions
    ->schema([
        TextInput::make('name')
    ])
```

   ![translatable horizontal component](https://raw.githubusercontent.com/webard/filament-translatable/refs/heads/v3/screenshots/horizontal-component-light.png)Note

Using the `translatable()` method within the `Translations` component is not needed.

Important

Be sure to set different names for each `Translations` component when using multiple instances.

#### Setting the translatable locales for specific components

[](#setting-the-translatable-locales-for-specific-components)

By default, locales are configured globally in the plugin settings. However, you can override the locales for a specific `Translations` component:

```
Translations::make('translations')
    ->locales(['en', 'es'])
```

#### Setting custom field labels per locale

[](#setting-custom-field-labels-per-locale)

You can customize field labels for each locale using the `fieldTranslatableLabel()` method. This is useful for translating field labels themselves:

```
use Webard\FilamentTranslatable\Forms\Component\Translations;

 Translations::make()
    ->schema([
        // Fields
    ])
    ->fieldTranslatableLabel(fn ($field, $locale) => __($field->getName(), locale: $locale))
```

#### Adding prefix/suffix locale labels to fields

[](#adding-prefixsuffix-locale-labels-to-fields)

You can add the locale name as a prefix or suffix to field labels using the `prefixLocaleLabel()` or `suffixLocaleLabel()` methods. This helps users identify which language they are editing:

```
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make('translations')
    ->schema([
        // Fields
    ])
    ->prefixLocaleLabel()
    ->suffixLocaleLabel()
```

#### Customizing the locale label format

[](#customizing-the-locale-label-format)

By default, the prefix/suffix locale label is generated from the locale code and enclosed in parentheses (e.g., "(English)"). You can customize this format using the `preformLocaleLabelUsing()` method:

```
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make('translations')
    ->preformLocaleLabelUsing(fn (string $locale, string $label) => "[{$label}]");
```

#### Conditionally adding locale labels

[](#conditionally-adding-locale-labels)

You can conditionally add prefix/suffix labels by injecting the `$field` parameter into the callback. This allows you to apply locale labels only to specific fields:

```
use Filament\Forms\Components\Component;
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make('translations')
    // ...
    ->prefixLocaleLabel(function(Component $field) {
        // Must return a boolean value
        return $field->getName() == 'title';
    })
    ->suffixLocaleLabel(function(Component $field) {
        // Must return a boolean value
        return $field->getName() == 'title';
    })
```

#### Adding actions to locale tabs

[](#adding-actions-to-locale-tabs)

You can add custom Filament actions to each locale tab using the `actions()` method. Actions appear in the tab header and can be used for operations like auto-translation or copying content between locales:

```
use Filament\Forms\Components\Actions\Action;
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make('translations')
    ->actions([
        Action::make('fillDumpTitle')
    ])
```

#### Accessing the locale in actions

[](#accessing-the-locale-in-actions)

To access the current locale within an action, use the `$arguments` parameter and retrieve the `locale` value:

```
use Filament\Forms\Components\Actions\Action;
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make()
    ->actions([
        Action::make('fillDumpTitle')
            ->action(function (array $arguments) {
                $locale = $arguments['locale'];
                // ...
            })
    ])
```

#### Accessing the locale in schema

[](#accessing-the-locale-in-schema)

You can access the current locale within the schema definition by defining a `$locale` parameter. This is useful for conditional logic based on the locale:

```
use Filament\Forms\Components\TextInput;
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make()
    ->schema(fn (string $locale) => [TextInput::make('title')->required($locale == 'en')])
```

#### Removing the styled container

[](#removing-the-styled-container)

By default, the `Translations` component is wrapped in a card-styled container. You can remove this styling using the `contained()` method:

```
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make()
    ->contained(false)
```

#### Vertical tabs

[](#vertical-tabs)

You can display translations as vertical tabs:

```
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make()
    ->vertical()
```

#### Overriding plugin settings per component

[](#overriding-plugin-settings-per-component)

You can override the global plugin settings directly on individual components:

```
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make()
    ->displayNamesInLocaleLabels(false)
    ->displayFlagsInLocaleLabels(true)
    ->flagWidth('48px')
```

#### Excluding fields from translation

[](#excluding-fields-from-translation)

The `exclude()` method allows you to specify fields that should not be translated. Excluded fields will appear in the form but will not be duplicated for each locale. This is useful for fields that contain non-translatable content:

```
use Webard\FilamentTranslatable\Forms\Component\Translations;

Translations::make('translations')
    ->schema([
        Forms\Components\TextInput::make('title'),
        Forms\Components\TextInput::make('description'),
    ])
    ->exclude(['description'])
```

Without `exclude`:

```
{
    "title": {
        "en": "Dump",
        "es": "Dump",
        "fr": "Dump"
    },
    "description": {
        "en": null,
        "es": null,
        "fr": null
    }
}
```

With `exclude`:

```
{
    "title": {
        "en": "Dump",
        "es": "Dump",
        "fr": "Dump"
    },
    "description": null
}
```

Publishing Views
----------------

[](#publishing-views)

To publish the views, run:

```
php artisan vendor:publish --provider="Webard\\FilamentTranslatable\\FilamentTranslatableProvider" --tag="filament-translatable-views"
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

See the [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

See [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Lipis](https://github.com/lipis/flag-icons) for icons
- [Solution Forest](https://github.com/solutionforest/filament-translate-field) for great inspiration
- [Outer Web](https://github.com/outer-web/filament-translatable-fields) for the macro idea
- [All Contributors](../../contributors)

License
-------

[](#license)

Filament Translatable is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance87

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 82.6% 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 ~20 days

Total

12

Last Release

54d ago

Major Versions

v2.0.3 → v3.0.02025-08-29

v2.x-dev → v3.3.12026-02-12

PHP version history (2 changes)v2.0.0PHP ^8.2

v3.3.1PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![webard](https://avatars.githubusercontent.com/u/855788?v=4)](https://github.com/webard "webard (76 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![wienczny](https://avatars.githubusercontent.com/u/301227?v=4)](https://github.com/wienczny "wienczny (1 commits)")

---

Tags

filamentfilamentphpi18nlaravellocalelocales-translationtranslation-managementtranslation-toolphplaraveli18ntranslationslaravel-translatablelocalefilamentfilamentphpfilament-translate-fieldwebardspatie-translatableastrotomic-translatablefilament-translatable

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/webard-filament-translatable/health.svg)

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

###  Alternatives

[solution-forest/filament-translate-field

Filament Translate Field

47101.5k1](/packages/solution-forest-filament-translate-field)[cactus-galaxy/filament-astrotomic

Filament support for Astrotomic's Laravel Translatable package.

2516.3k](/packages/cactus-galaxy-filament-astrotomic)[andreia/filament-nord-theme

A minimalist Arctic Nord theme for FilamentPHP

13334.7k2](/packages/andreia-filament-nord-theme)[tomatophp/filament-translations-gpt

Translations Manager extension to use ChatGPT openAI to auto translate your \_\_(), trans() fn

293.9k](/packages/tomatophp-filament-translations-gpt)

PHPackages © 2026

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