PHPackages                             solution-forest/filament-translate-field - 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. solution-forest/filament-translate-field

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

solution-forest/filament-translate-field
========================================

Filament Translate Field

3.0.0(3mo ago)47101.5k↓14.7%17[3 issues](https://github.com/solutionforest/filament-translate-field/issues)[4 PRs](https://github.com/solutionforest/filament-translate-field/pulls)1MITPHPPHP ^8.2CI passing

Since Jan 4Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/solutionforest/filament-translate-field)[ Packagist](https://packagist.org/packages/solution-forest/filament-translate-field)[ Docs](https://github.com/solution-forest/filament-translate-field)[ RSS](/packages/solution-forest-filament-translate-field/feed)WikiDiscussions 3.x Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (21)Used By (1)

Filament Translate Field
========================

[](#filament-translate-field)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1a137c7e98cf654b2797ba46c2774120d8fd7c94feff6d962853805cc0087101/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6c7574696f6e2d666f726573742f66696c616d656e742d7472616e736c6174652d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/solution-forest/filament-translate-field)[![Total Downloads](https://camo.githubusercontent.com/f227c97d0d92f960bf5d7d69c3a1efbe77de305cc242de9bd00fc675500cba2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6c7574696f6e2d666f726573742f66696c616d656e742d7472616e736c6174652d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/solution-forest/filament-translate-field)

Filament Translate Field is a library for Filament CMS that simplifies managing multiple translatable fields in different languages.

[![filament-translate-field-1](https://private-user-images.githubusercontent.com/68525320/295838374-34c74a8f-fd8e-4db6-a967-31deecdf113b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNDg1NDQsIm5iZiI6MTc3NTI0ODI0NCwicGF0aCI6Ii82ODUyNTMyMC8yOTU4MzgzNzQtMzRjNzRhOGYtZmQ4ZS00ZGI2LWE5NjctMzFkZWVjZGYxMTNiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDIwMzA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA3NDZlMWY4N2JjMTkyZmIzN2EyNWEzNjk2NTUxNmZlOWM2ZTg1ZTg4ZWE2YWVjYTI2M2M2YjI2OTU2M2U0YTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.hxqmYkFOmPpsVCB_bs0vrWNJZ8VFJ3kQoX86pTVjeCY)](https://private-user-images.githubusercontent.com/68525320/295838374-34c74a8f-fd8e-4db6-a967-31deecdf113b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNDg1NDQsIm5iZiI6MTc3NTI0ODI0NCwicGF0aCI6Ii82ODUyNTMyMC8yOTU4MzgzNzQtMzRjNzRhOGYtZmQ4ZS00ZGI2LWE5NjctMzFkZWVjZGYxMTNiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDIwMzA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA3NDZlMWY4N2JjMTkyZmIzN2EyNWEzNjk2NTUxNmZlOWM2ZTg1ZTg4ZWE2YWVjYTI2M2M2YjI2OTU2M2U0YTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.hxqmYkFOmPpsVCB_bs0vrWNJZ8VFJ3kQoX86pTVjeCY)

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

[](#installation)

Filament VersionFilament Translate Field Versionv3.xv0.x – v1.xv4.xv2.xv5.xv3.xYou can install the package via composer:

```
composer require solution-forest/filament-translate-field
```

Publish the assets:

```
php artisan filament:assets
```

```
php artisan optimize
```

Important
---------

[](#important)

- There's a conflict with the Translatable trait in the [filament/spatie-laravel-translatable-plugin](https://filamentphp.com/plugins/filament-spatie-translatable) when used on the EditPage. Avoid using Translatable while editing.

Configuration:
--------------

[](#configuration)

- Define translatable fields in your model using a translatable package (e.g., "spatie/laravel-translatable" or "dimsav/laravel-translatable").
- Configure translatable fields in the model's *$translatable* property.

Setup
-----

[](#setup)

 **For version before 1.x.x**###  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 SolutionForest\FilamentTranslateField\FilamentTranslateFieldPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(FilamentTranslateFieldPlugin::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 SolutionForest\FilamentTranslateField\FilamentTranslateFieldPlugin;

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

 **For version equal or after 1.x.x**###  Setting the default translatable locales

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

Since the plugin after 1.x.x is a standalone plugin, which does not need to be related to Filament Panel, so you need to globally set it up in the config file or use the boot method in `AppServiceProvider`.

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 SolutionForest\FilamentTranslateField\Facades\FilamentTranslateField;

class AppServiceProvider extends ServiceProvider
{
   public function boot(): void
   {
       FilamentTranslateField::defaultLocales(['en', 'es', 'fr']);
   }
}
```

Or, you can publish configuration file `config/filament-translate-field.php` and add default locales on `locales`:

```
return [
    'locales' => ['en', 'es', 'fr'],
];
```

Usage
-----

[](#usage)

### Form component

[](#form-component)

By using the `Translate` component, you can easily configure your [form fields](https://filamentphp.com/docs/3.x/forms/fields/getting-started) to support multiple languages and provide translations for each locale.

```
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\RichEditor;
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

Translate::make()
    ->schema([
         // Your form fields here
    ])
```

#### Setting the translatable locales for a particular fields

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

By default, the translatable locales can be set globally for all translate form component in the plugin configuration. Alternatively, you can customize the translatable locales for a particular resource by overriding the `locales()` method in `Translate` class:

```
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

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

#### Label

[](#label)

##### Setting the translatable label for a particular field

[](#setting-the-translatable-label-for-a-particular-field)

You have the flexibility to customize the translate label for each field in each locale. You can use the `fieldTranslatableLabel()` method to provide custom labels based on the field instance and the current locale.

```
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

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

##### Adding prefix/suffix locale label to the field

[](#adding-prefixsuffix-locale-label-to-the-field)

If you simply want to add a prefix or suffix locale label to the form field, you can use the `prefixLocaleLabel()` or `suffixLocaleLabel()` method. This makes it easier for users to identify the language associated with each field.

```
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

Translate::make()
    ->schema([
        // Fields
    ])
    ->prefixLocaleLabel()
    ->suffixLocaleLabel()
```

> `prefixLocaleLabel:
>
> [![filament-translate-field-3](https://private-user-images.githubusercontent.com/68525320/294076145-0203e682-f324-4957-8680-4cffccab300c.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNDg1NDQsIm5iZiI6MTc3NTI0ODI0NCwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYxNDUtMDIwM2U2ODItZjMyNC00OTU3LTg2ODAtNGNmZmNjYWIzMDBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDIwMzA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1YmZiYjkzYzlmNGNhMDllNmUxNWViM2U2YmE4ODJjZTY2OTMyZTRjZWFiZTgyMWQyMmMzN2QzY2RjOTU1MTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.NZeLx9upHxaKqTBWDJ1EY17x0ADq7A3UnwrEBxhcbpw)](https://private-user-images.githubusercontent.com/68525320/294076145-0203e682-f324-4957-8680-4cffccab300c.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNDg1NDQsIm5iZiI6MTc3NTI0ODI0NCwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYxNDUtMDIwM2U2ODItZjMyNC00OTU3LTg2ODAtNGNmZmNjYWIzMDBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDIwMzA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1YmZiYjkzYzlmNGNhMDllNmUxNWViM2U2YmE4ODJjZTY2OTMyZTRjZWFiZTgyMWQyMmMzN2QzY2RjOTU1MTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.NZeLx9upHxaKqTBWDJ1EY17x0ADq7A3UnwrEBxhcbpw)

> `suffixLocaleLabel`:
>
> [![filament-translate-field-4](https://private-user-images.githubusercontent.com/68525320/294076272-7f4403e9-c857-4ebf-b022-8fed12094426.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNDg1NDQsIm5iZiI6MTc3NTI0ODI0NCwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYyNzItN2Y0NDAzZTktYzg1Ny00ZWJmLWIwMjItOGZlZDEyMDk0NDI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDIwMzA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwY2ExOTNjMTcwMzQ2MDg0YzNiYTE2NDU3MDE3NmExYWY0NjQyMTUyNmU4YTg1NTg1NTdjY2Y0ZjRkNjQ2NzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.hiFelU_DDHpSXG1t9w0DSa6FyCaQFN8AMxgS992uR9c)](https://private-user-images.githubusercontent.com/68525320/294076272-7f4403e9-c857-4ebf-b022-8fed12094426.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNDg1NDQsIm5iZiI6MTc3NTI0ODI0NCwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYyNzItN2Y0NDAzZTktYzg1Ny00ZWJmLWIwMjItOGZlZDEyMDk0NDI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDIwMzA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwY2ExOTNjMTcwMzQ2MDg0YzNiYTE2NDU3MDE3NmExYWY0NjQyMTUyNmU4YTg1NTg1NTdjY2Y0ZjRkNjQ2NzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.hiFelU_DDHpSXG1t9w0DSa6FyCaQFN8AMxgS992uR9c)

#### Setting the locale display name

[](#setting-the-locale-display-name)

By default, the prefix/suffix locale display name is generated by locale code and enclosed in parentheses, "()". You may customize this using the `preformLocaleLabelUsing()` method:

```
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

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

#### Injecting the current form field

[](#injecting-the-current-form-field)

Additionally, if you need to access the current form field instance, you can inject the `$field` parameter into the callback functions. This allows you to perform specific actions or conditions based on the field being processed.

```
use Filament\Forms\Components\Component;
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

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

[![filament-translate-field-5](https://private-user-images.githubusercontent.com/68525320/294076396-a88fcb69-a63d-43a6-857b-5323df877134.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNDg1NDQsIm5iZiI6MTc3NTI0ODI0NCwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYzOTYtYTg4ZmNiNjktYTYzZC00M2E2LTg1N2ItNTMyM2RmODc3MTM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDIwMzA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQxYjRiMjdhNmIwYWQzNmY0ZTE5M2YxMGFhYThjZDJjYzdiYTYzNDM1NmY2OTBmZDU1NWQ3NWQxOGE0ZGU5ODcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.2n6t0pncvcn8uQBecQD3JLYmVP9xmqs3E9RDNmW_XcY)](https://private-user-images.githubusercontent.com/68525320/294076396-a88fcb69-a63d-43a6-857b-5323df877134.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNDg1NDQsIm5iZiI6MTc3NTI0ODI0NCwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYzOTYtYTg4ZmNiNjktYTYzZC00M2E2LTg1N2ItNTMyM2RmODc3MTM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDIwMzA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQxYjRiMjdhNmIwYWQzNmY0ZTE5M2YxMGFhYThjZDJjYzdiYTYzNDM1NmY2OTBmZDU1NWQ3NWQxOGE0ZGU5ODcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.2n6t0pncvcn8uQBecQD3JLYmVP9xmqs3E9RDNmW_XcY)

### Adding action

[](#adding-action)

You may add actions before each container of children components using the `actions()` method:

```
use Filament\Forms\Components\Actions\Action;
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

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

> *If have multiple `Translate` components and have action in each component, please add id to `Translate` component by `id()` method*

#### Injecting the locale on current child container

[](#injecting-the-locale-on-current-child-container)

If you wish to access the locale that have been passed to the action, define an `$arguments` parameter and get the value of `locale` from `$arguments`:

```
use Filament\Forms\Components\Actions\Action;
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

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

### Injecting the locale to form field

[](#injecting-the-locale-to-form-field)

If you wish to access the current locale instance for the field, define a `$locale` parameter:

```
use Filament\Forms\Components\TextInput;
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

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

### Removing the styled container

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

By default, translate component and their content are wrapped in a container styled as a card. You may remove the styled container using `contained()`:

```
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

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

### Exclude

[](#exclude)

The `exclude` feature allows you to specify fields that you don't want to be included in the translation process. This can be useful for fields that contain dynamic content or that shouldn't be translated into other languages.

```
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

Translate::make([
        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, use:

```
php artisan vendor:publish --provider="SolutionForest\\FilamentTranslateField\\FilamentTranslateFieldServiceProvider" --tag="filament-translate-field-views"
```

Publishing Configuration file
-----------------------------

[](#publishing-configuration-file)

To publish the configuration file, use:

```
php artisan vendor:publish --provider="SolutionForest\\FilamentTranslateField\\FilamentTranslateFieldServiceProvider" --tag="filament-translate-field-config"
```

Example
-------

[](#example)

### Demo

[](#demo)

    FIlament.Translate.Field.Demo-2.mp4    ### Sample Code

[](#sample-code)

In Filament panel:

```
use SolutionForest\FilamentTranslateField\FilamentTranslateFieldPlugin;

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

In app/Filament/Resources/NewsResource.php:

```
use Filament\Forms;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\RichEditor;
use Filament\Resources\Resource;
use SolutionForest\FilamentTranslateField\Forms\Component\Translate;

class NewsResource extends Resource
{
    // ...

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Translate::make()
                    ->columnSpanFull()
                    ->columns(2)
                    ->schema([
                        TextInput::make('title')->required(),
                        Textarea::make('short_desc'),
                        RichEditor::make('description')->columnSpanFull(),
                    ])
                    ->fieldTranslatableLabel(fn ($field, $locale) => __($field->getName(), locale: $locale))
                    ->actions([
                        Forms\Components\Actions\Action::make('test')
                            ->label("Fill dump title")
                            ->visible(fn ($arguments) => $arguments['locale']  == 'en')
                            ->action(function ($set, $arguments) {
                                $locale = $arguments['locale'] ?? null;
                                if (! $locale) {
                                    return;
                                }
                                $set("title.$locale", fake()->text(50));
                            })
                    ]),
            ]);
    }

    public static function table(Table $table): Table
    {
        return $table
            ->columns([

                Tables\Columns\ColumnGroup::make('Data')
                    ->columns([
                        Tables\Columns\TextColumn::make('title')
                            ->getStateUsing(fn ($record) => new HtmlString(collect($record->title)
                                ->map(fn ($state, $locale) => getStateUsing(fn ($record) => new HtmlString(collect($record->short_desc)
                                ->map(fn ($state, $locale) => getStateUsing(fn ($record) => new HtmlString(collect($record->description)
                                ->map(fn ($state, $locale) =>  'json',
        'short_desc' => 'json',
        'description' => 'json',
    ];

    // ...
}
```

In resources/lang/en.json:

```
{
    "title": "Title",
    "short_desc": "Short description",
    "description": "Description"
}
```

In resources/lang/es.json:

```
{
    "title": "Título",
    "short_desc": "Breve descripción",
    "description": "Descripción"
}
```

In resources/lang/fr.json:

```
{
    "title": "Titre",
    "short_desc": "Brève description",
    "description": "Description"
}
```

In the given example, when you save the model, the data will be stored in the following format:

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

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)

- \[Carly\]
- [All Contributors](../../contributors)

License
-------

[](#license)

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

[![](https://github.com/solutionforest/.github/raw/main/docs/images/sf.png?raw=true)](https://solutionforest.com)

About Solution Forest
---------------------

[](#about-solution-forest)

[Solution Forest](https://solutionforest.com) Web development agency based in Hong Kong. We help customers to solve their problems. We Love Open Soruces.

We have built a collection of best-in-class products:

- [InspireCMS](https://inspirecms.net): A full-featured Laravel CMS with everything you need out of the box. Build smarter, ship faster with our complete content management solution.
- [Filaletter](https://filaletter.solutionforest.net): Filaletter - Filament Newsletter Plugin
- [Website CMS Management](https://filamentphp.com/plugins/solution-forest-cms-website): A hands-on Filament CMS plugin for those who prefer more manual control over their website content management.

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance85

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~42 days

Total

19

Last Release

106d ago

Major Versions

0.x-dev → 1.0.02024-02-07

1.4.1 → 2.0.02025-07-22

1.x-dev → 2.0.12025-09-05

2.1.0 → 3.0.02026-02-02

PHP version history (2 changes)0.0.1PHP ^8.1

2.0.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9499120912b47a170291b3b795ea0255f060d8500bd2988535e4e6faccee5c8d?d=identicon)[solutionforest](/maintainers/solutionforest)

---

Top Contributors

[![cklei-carly](https://avatars.githubusercontent.com/u/68525320?v=4)](https://github.com/cklei-carly "cklei-carly (62 commits)")[![repl6669](https://avatars.githubusercontent.com/u/5587309?v=4)](https://github.com/repl6669 "repl6669 (14 commits)")[![mstfkhazaal](https://avatars.githubusercontent.com/u/47450090?v=4)](https://github.com/mstfkhazaal "mstfkhazaal (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![sfkelseylee](https://avatars.githubusercontent.com/u/138422247?v=4)](https://github.com/sfkelseylee "sfkelseylee (9 commits)")[![lam0819](https://avatars.githubusercontent.com/u/68211972?v=4)](https://github.com/lam0819 "lam0819 (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![nabileisa](https://avatars.githubusercontent.com/u/6467131?v=4)](https://github.com/nabileisa "nabileisa (1 commits)")[![jeffreyvanhees](https://avatars.githubusercontent.com/u/8754630?v=4)](https://github.com/jeffreyvanhees "jeffreyvanhees (1 commits)")[![rojtjo](https://avatars.githubusercontent.com/u/1123887?v=4)](https://github.com/rojtjo "rojtjo (1 commits)")[![ctoma](https://avatars.githubusercontent.com/u/11610991?v=4)](https://github.com/ctoma "ctoma (1 commits)")[![webard](https://avatars.githubusercontent.com/u/855788?v=4)](https://github.com/webard "webard (1 commits)")[![GigaGiorgadze](https://avatars.githubusercontent.com/u/75663118?v=4)](https://github.com/GigaGiorgadze "GigaGiorgadze (1 commits)")

---

Tags

laravellaravel-translatablefilamentSolution Forestfilament-translate-field

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/solution-forest-filament-translate-field/health.svg)

```
[![Health](https://phpackages.com/badges/solution-forest-filament-translate-field/health.svg)](https://phpackages.com/packages/solution-forest-filament-translate-field)
```

###  Alternatives

[kenepa/translation-manager

Manage your application's translation strings in Filament.

14583.6k2](/packages/kenepa-translation-manager)[cactus-galaxy/filament-astrotomic

Filament support for Astrotomic's Laravel Translatable package.

2516.3k](/packages/cactus-galaxy-filament-astrotomic)[abdulmajeed-jamaan/filament-translatable-tabs

Simplifying managing json based translation columns using tabs

3755.2k1](/packages/abdulmajeed-jamaan-filament-translatable-tabs)

PHPackages © 2026

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