34ml/filament-translatable-field

A laravel filament field that handle translation
3,710 18
Install
composer require 34ml/filament-translatable-field
Latest Version:v3.0
PHP:^8.3
Laravel:12
Older releases:4 – 11
License:MIT
Last Updated:Jul 21, 2026
Links: GitHub  ·  Packagist
Maintainer: admin34ML

A filament field that handles translations

translatableFieldHeader

This package enables you to implement the following:

  1. Render a language selector to change the localized field
  2. You can save your localized fields data in one click
  3. You can use it in your relationship manager to show the localized fields

translatableField

This package depends on spatie/laravel-translatable, Please check it first to set up your translation logic in your project.

Installation

You can install the package via composer:

composer require 34ml/filament-translatable-field

You can publish the config file with:

php artisan vendor:publish --tag="filament-translatable-field-config"

This is the content of the published config file where fields are created for each language listed here

return [
    'locales' => [
        'en' => 'English',
        'ar' => 'Arabic',
    ],
    'select_translation_field_name' => 'select_language',
];

Translatable Field Usage

Basic Usage

  • Just add the field in your resource, view, create,or edit pages inside the form function
 ..._34ML\FilamentTranslatableField::make(
     'your_translatable_field_name',
     \Filament\Forms\Components\TextInput::class, // The field type class 
)
  • If you want to customize the label of the field
 ..._34ML\FilamentTranslatableField::make(
     'your_translatable_field_name',
     \Filament\Forms\Components\TextInput::class, // The field type class
     'your_field_displayed_name', // Optional
)
  • If you want to add filament field functions
  ..._34ML\FilamentTranslatableField::make(
     'your_translatable_field_name',
     \Filament\Forms\Components\TextInput::class, // The field type class 
    // add your filament field functions as a callback, you can add it as one function
    callbacks: function (){
        $this->required();
        $this->numeric();
        return $this; // You have to return the field or the callbacks won't work
    }
)

Language Selector

If you want to add a language selector that shows only the selected language's fields instead of showing all fields you can simply add this field in your resource, view, create,or edit pages inside the form function

use _34ML\FilamentTranslatableField\Forms\Components\LanguageSelector;

return $form
           ->schema([
               LanguageSelector::make(),
                ]);

Relationship Manager

you need to add this code to your relationship manager

    public static function getRecordTitle(?Model $record): ?string
    {
        return $record->getTranslation('your_title_column', config('filament-translatable-field.locales')[0]);
    }

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

34ml/laravel-seo

This package will help you to manage your website SEO easily.

6,996 1
34ml/filament-seo

SEO package for Filament Admin Panel

1,549 9
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441

Version History

Version Released PHP Laravel License
v3.0 ^8.3 ^12.0 MIT
v2.1.2 ^8.3 ^12.0 MIT
v2.1.1 ^8.3 ^12.0 MIT
v2.1 ^8.3 ^11.28 MIT
v2.0.14 ^8.1 | ^8.2 * MIT