PHPackages                             bambolee-digital/filament-translate - 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. bambolee-digital/filament-translate

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

bambolee-digital/filament-translate
===================================

A plugin for Filament that adds translation features to form fields, allowing content to be translated directly within the FilamentPHP admin interface.

1.0.4(1y ago)030MITPHPPHP ^8.1

Since Sep 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Bambolee-Digital/filament-translate)[ Packagist](https://packagist.org/packages/bambolee-digital/filament-translate)[ RSS](/packages/bambolee-digital-filament-translate/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

Filament Translate
==================

[](#filament-translate)

Filament Translate is a powerful and flexible package that adds translation capabilities to your Filament PHP admin panel. It allows you to easily translate fields directly within the Filament interface.

Requirements
------------

[](#requirements)

- PHP 8.0+
- Laravel 8.0+
- Filament PHP 2.0+
- Spatie Laravel Translatable

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

[](#installation)

1. Install the package via Composer:

```
composer require bamboolee-digital/filament-translate
```

2. Publish the configuration file:

```
php artisan vendor:publish --tag="filament-translate-config"
```

3. Publish the translation files (optional, but recommended for customization):

```
php artisan vendor:publish --tag="filament-translate-translations"
```

4. Add the `Spatie\Translatable\HasTranslations` trait to your model:

```
use Spatie\Translatable\HasTranslations;

class Post extends Model
{
    use HasTranslations;

    public $translatable = ['title', 'content'];
}
```

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

[](#configuration)

In the `config/filament-translate.php` file, you can configure:

```
return [
    'default_engine' => 'deepl',
    'engines' => [
        'deepl' => [
            'name' => 'DeepL',
            'class' => \BambooleeDigital\FilamentTranslate\Engines\DeepLEngine::class,
            'api_key' => env('DEEPL_API_KEY'),
            'available_locales' => [
                'en-us' => 'English (American)',
                'es' => 'Spanish (Spain)',
                'pt-br' => 'Portuguese (Brazil)',
            ],
        ],
        // Add other engines here
    ],
    'languages' => [
        'en-US' => 'English (American)',
        'es-ES' => 'Spanish (Spain)',
        'pt-BR' => 'Portuguese (Brazil)',
        // Add more languages as needed
    ],
    'default_source_language' => null,
    'source_locale_strategy' => 'dynamic', // or 'fixed'
];
```

Usage
-----

[](#usage)

### Making a Field Translatable

[](#making-a-field-translatable)

To make a field translatable in your Filament resource, use the `translatable()` method:

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

public static function form(Form $form): Form
{
    return $form
        ->schema([
            TextInput::make('title')
                ->translatable()
                ->required(),
            // ... other fields
        ]);
}
```

### Specifying an Active Locale

[](#specifying-an-active-locale)

You can specify an active locale when using the `translatable()` method:

```
TextInput::make('title')
    ->translatable(activeLocale: 'en')
```

The `activeLocale` determines which translation will be initially displayed in the field.

How It Works
------------

[](#how-it-works)

When you call `->translatable()` on a field, the package adds an action button next to the field. Clicking this button opens a modal, allowing you to translate the field's content into different languages using the configured translation engine.

Customizing Translations
------------------------

[](#customizing-translations)

You can customize the translation strings used by the package. After publishing the translation files, you can edit them in `resources/lang/vendor/filament-translate`.

For example, to customize the English translations, edit the file `resources/lang/vendor/filament-translate/en/filament-translate.php`:

```
return [
    'modal_title' => 'Translate Content',
    'engine' => 'Translation Service',
    'source' => 'Original Language',
    'target' => 'Target Language',
    'translate' => 'Translate Now',
    // ... other translations
];
```

Creating a Custom Translation Engine
------------------------------------

[](#creating-a-custom-translation-engine)

Here's an example of how to create a Google Translate engine:

1. Create a new class that implements the `TranslationEngine` interface:

```
use BambooleeDigital\FilamentTranslate\Contracts\TranslationEngine;
use Google\Cloud\Translate\V2\TranslateClient;

class GoogleTranslateEngine implements TranslationEngine
{
    protected TranslateClient $client;

    public function __construct(string $apiKey)
    {
        $this->client = new TranslateClient([
            'key' => $apiKey
        ]);
    }

    public function translate(string $text, string $targetLanguage, ?string $sourceLanguage = null): string
    {
        $result = $this->client->translate($text, [
            'target' => $targetLanguage,
            'source' => $sourceLanguage,
        ]);

        return $result['text'];
    }

    public function getSupportedLanguages(): array
    {
        $languages = $this->client->languages();
        return array_combine($languages, $languages);
    }
}
```

2. Register your custom engine in the config file:

```
'engines' => [
    'google' => [
        'name' => 'Google Translate',
        'class' => \App\TranslationEngines\GoogleTranslateEngine::class,
        'api_key' => env('GOOGLE_TRANSLATE_API_KEY'),
        'available_locales' => [
            'en' => 'English',
            'es' => 'Spanish',
            'fr' => 'French',
            // Add more as needed
        ],
    ],
],
```

3. Set it as the default engine or use it selectively in your fields:

```
TextInput::make('title')
    ->translatable()
    ->translateEngine('google')
```

Complete Example
----------------

[](#complete-example)

Here's a complete example of using Filament Translate in a Filament resource:

```
use App\Models\Post;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Resource;

class PostResource extends Resource
{
    protected static ?string $model = Post::class;

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\TextInput::make('title')
                    ->required()
                    ->translatable(activeLocale: app()->getLocale()),

                Forms\Components\RichEditor::make('content')
                    ->required()
                    ->translatable(),

                Forms\Components\TextInput::make('author')
                    ->required(),

                // This field won't be translatable
                Forms\Components\DatePicker::make('published_at'),
            ]);
    }

    // ... other resource methods
}
```

In this example:

- The 'title' and 'content' fields are translatable.
- The 'title' field uses the current application locale as the active locale.
- The 'content' field uses the package's default locale.
- The 'author' and 'published\_at' fields are not translatable.

Troubleshooting
---------------

[](#troubleshooting)

If translations are not working:

1. Ensure the `HasTranslations` trait is properly added to your model.
2. Verify that the fields are listed in the `$translatable` array in your model.
3. Check that the correct languages are set in your `config/filament-translate.php` file.
4. Confirm your translation engine (e.g., DeepL) is properly configured with a valid API key.
5. Clear Laravel's cache: `php artisan cache:clear`
6. If package translation strings are not appearing, try using `trans('filament-translate::filament-translate.key')` instead of `__()`.

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).

Author
------

[](#author)

Kellvem Barbosa (kellvembarbosa)# filament-translate

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Total

4

Last Release

595d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ea0811b77232bb232cc41a918466de4b146044ce293582045f2df13eeeeffd7f?d=identicon)[bambolee-digital](/maintainers/bambolee-digital)

---

Top Contributors

[![kellvembarbosa](https://avatars.githubusercontent.com/u/3621135?v=4)](https://github.com/kellvembarbosa "kellvembarbosa (8 commits)")

---

Tags

translationfilamentfilamentphpfilament-translatetranslation-plugintranslation-packagetranslation-featurestranslation-plugin-for-filament

### Embed Badge

![Health badge](/badges/bambolee-digital-filament-translate/health.svg)

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

###  Alternatives

[kenepa/translation-manager

Manage your application's translation strings in Filament.

14583.6k2](/packages/kenepa-translation-manager)[abdulmajeed-jamaan/filament-translatable-tabs

Simplifying managing json based translation columns using tabs

3755.2k1](/packages/abdulmajeed-jamaan-filament-translatable-tabs)[tomatophp/filament-translations-gpt

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

293.9k](/packages/tomatophp-filament-translations-gpt)[cactus-galaxy/filament-astrotomic

Filament support for Astrotomic's Laravel Translatable package.

2516.3k](/packages/cactus-galaxy-filament-astrotomic)

PHPackages © 2026

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