PHPackages                             microweber-deps/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. microweber-deps/filament-translate-field

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

microweber-deps/filament-translate-field
========================================

Filament Translate Field

1.0(9mo ago)02MITPHP

Since Jul 19Pushed 9mo agoCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxODU2ODksIm5iZiI6MTc3NTE4NTM4OSwicGF0aCI6Ii82ODUyNTMyMC8yOTU4MzgzNzQtMzRjNzRhOGYtZmQ4ZS00ZGI2LWE5NjctMzFkZWVjZGYxMTNiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDAzMDMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJmODhjYTEyMGUxODE2NzdkZjVjYjE4NWViZWI5NzYzYWI0MzY5YzViODc5MGNkYzZmZjEwMDE5NTk5YWI4YTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.AnRlEgOiEPsqcsHy7tG9dUBlUOpdaZH38oOh46Mu-VU)](https://private-user-images.githubusercontent.com/68525320/295838374-34c74a8f-fd8e-4db6-a967-31deecdf113b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxODU2ODksIm5iZiI6MTc3NTE4NTM4OSwicGF0aCI6Ii82ODUyNTMyMC8yOTU4MzgzNzQtMzRjNzRhOGYtZmQ4ZS00ZGI2LWE5NjctMzFkZWVjZGYxMTNiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDAzMDMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJmODhjYTEyMGUxODE2NzdkZjVjYjE4NWViZWI5NzYzYWI0MzY5YzViODc5MGNkYzZmZjEwMDE5NTk5YWI4YTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.AnRlEgOiEPsqcsHy7tG9dUBlUOpdaZH38oOh46Mu-VU)

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

[](#installation)

You can install the package via composer:

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

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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxODU2ODksIm5iZiI6MTc3NTE4NTM4OSwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYxNDUtMDIwM2U2ODItZjMyNC00OTU3LTg2ODAtNGNmZmNjYWIzMDBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDAzMDMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI2YmQ3OTEzNDgxYzc0MmUxZjcwNDFjZjg5ZjU3ZjcyNjIwMmZlMWU3MGNiNmJiODJmNmI2MjBlODhiMjQzYjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.lNYlWe1hQXfhNYSG2hb7tXDo9xlCuICIVscZLuZUPxg)](https://private-user-images.githubusercontent.com/68525320/294076145-0203e682-f324-4957-8680-4cffccab300c.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxODU2ODksIm5iZiI6MTc3NTE4NTM4OSwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYxNDUtMDIwM2U2ODItZjMyNC00OTU3LTg2ODAtNGNmZmNjYWIzMDBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDAzMDMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI2YmQ3OTEzNDgxYzc0MmUxZjcwNDFjZjg5ZjU3ZjcyNjIwMmZlMWU3MGNiNmJiODJmNmI2MjBlODhiMjQzYjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.lNYlWe1hQXfhNYSG2hb7tXDo9xlCuICIVscZLuZUPxg)

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

#### 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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxODU2ODksIm5iZiI6MTc3NTE4NTM4OSwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYzOTYtYTg4ZmNiNjktYTYzZC00M2E2LTg1N2ItNTMyM2RmODc3MTM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDAzMDMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5NTg1YTNlMTI3ZDY5MWJmZWZiY2NkMDJkNGNmNjgzNmZhODg2OGRiMzk3MGIyNDM1MTlkZmNkMzA4NjViZTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.0y7XxoMoppmv6ZyD9UAQqdEVi5unDbqj_XFFHNjd-lg)](https://private-user-images.githubusercontent.com/68525320/294076396-a88fcb69-a63d-43a6-857b-5323df877134.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxODU2ODksIm5iZiI6MTc3NTE4NTM4OSwicGF0aCI6Ii82ODUyNTMyMC8yOTQwNzYzOTYtYTg4ZmNiNjktYTYzZC00M2E2LTg1N2ItNTMyM2RmODc3MTM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAzVDAzMDMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5NTg1YTNlMTI3ZDY5MWJmZWZiY2NkMDJkNGNmNjgzNmZhODg2OGRiMzk3MGIyNDM1MTlkZmNkMzA4NjViZTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.0y7XxoMoppmv6ZyD9UAQqdEVi5unDbqj_XFFHNjd-lg)

### 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\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('testy')
                            ->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:

- [VantagoAds](https://vantagoads.com): A self manage Ads Server, Simplify Your Advertising Strategy.
- [GatherPro.events](https://gatherpro.events): A Event Photos management tools, Streamline Your Event Photos.
- [Website CMS Management](https://filamentphp.com/plugins/solution-forest-cms-website): Website CMS Management - Filament CMS Plugin
- [Filaletter](https://filaletter.solutionforest.net): Filaletter - Filament Newsletter Plugin

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance55

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 68.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 ~0 days

Total

2

Last Release

298d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dc06e05e127ad3192ef9797ace808069687140538add8e6dbad34ce50bcd1f8?d=identicon)[boksiora](/maintainers/boksiora)

---

Top Contributors

[![cklei-carly](https://avatars.githubusercontent.com/u/68525320?v=4)](https://github.com/cklei-carly "cklei-carly (48 commits)")[![mstfkhazaal](https://avatars.githubusercontent.com/u/47450090?v=4)](https://github.com/mstfkhazaal "mstfkhazaal (10 commits)")[![lam0819](https://avatars.githubusercontent.com/u/68211972?v=4)](https://github.com/lam0819 "lam0819 (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![jeffreyvanhees](https://avatars.githubusercontent.com/u/8754630?v=4)](https://github.com/jeffreyvanhees "jeffreyvanhees (1 commits)")[![GigaGiorgadze](https://avatars.githubusercontent.com/u/75663118?v=4)](https://github.com/GigaGiorgadze "GigaGiorgadze (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![nabileisa](https://avatars.githubusercontent.com/u/6467131?v=4)](https://github.com/nabileisa "nabileisa (1 commits)")[![peter-mw](https://avatars.githubusercontent.com/u/5698247?v=4)](https://github.com/peter-mw "peter-mw (1 commits)")[![rojtjo](https://avatars.githubusercontent.com/u/1123887?v=4)](https://github.com/rojtjo "rojtjo (1 commits)")

---

Tags

laravellaravel-translatablefilamentSolution Forestfilament-translate-field

### Embed Badge

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

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

###  Alternatives

[solution-forest/filament-translate-field

Filament Translate Field

47101.5k1](/packages/solution-forest-filament-translate-field)[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)[mvenghaus/filament-plugin-translatable-inline

An alternative to https://github.com/filamentphp/spatie-laravel-translatable-plugin. The difference is that all translations occur directly under each field.

2045.5k](/packages/mvenghaus-filament-plugin-translatable-inline)

PHPackages © 2026

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