PHPackages                             martin6363/filament-ai-translator - 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. martin6363/filament-ai-translator

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

martin6363/filament-ai-translator
=================================

AI-powered auto-translation for Spatie Translatable fields in Filament 4 and 5

v1.0.0(today)00MITPHPPHP ^8.2|^8.3

Since Jun 18Pushed todayCompare

[ Source](https://github.com/Martin6363/filament-ai-translator)[ Packagist](https://packagist.org/packages/martin6363/filament-ai-translator)[ Docs](https://github.com/martin6363/filament-ai-translator)[ RSS](/packages/martin6363-filament-ai-translator/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Filament AI Translator
======================

[](#filament-ai-translator)

 **AI-powered, one-click translations for Filament form fields — built for Spatie Translatable and locale-suffixed layouts alike.**

 [![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE) [![Latest Version](https://camo.githubusercontent.com/38adc32c2c7ca8e50e8d9e858efae60a5952545900e124a1e6064e90415e1e19/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617274696e363336332f66696c616d656e742d61692d7472616e736c61746f723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/martin6363/filament-ai-translator) [![PHP Version](https://camo.githubusercontent.com/79b20b8a9d663b844428e46040e70180a561776246a5c749aba8dfbaf166eaaa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/79b20b8a9d663b844428e46040e70180a561776246a5c749aba8dfbaf166eaaa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Laravel Version](https://camo.githubusercontent.com/e35ee804631bee7f83a29cb71a57ec0d29b300ce4fa1ef1c8ae2ebca2390ef4f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d2535453131253230253743253230253545313225323025374325323025354531332d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/e35ee804631bee7f83a29cb71a57ec0d29b300ce4fa1ef1c8ae2ebca2390ef4f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d2535453131253230253743253230253545313225323025374325323025354531332d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465) [![Filament Version](https://camo.githubusercontent.com/fd237274119d4f87ca86be824aa10ea62ded813b2540f7bd33f77ad5e549af7c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f66696c616d656e742d25354534253230253743253230253545352d4635394530423f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/fd237274119d4f87ca86be824aa10ea62ded813b2540f7bd33f77ad5e549af7c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f66696c616d656e742d25354534253230253743253230253545352d4635394530423f7374796c653d666c61742d737175617265)

 Translate content across locales in seconds using Google Gemini — directly inside your Filament admin panel.

---

✨ Features
----------

[](#-features)

FeatureDescription🌍 **Dual-Mode Integration**Works with **Spatie Translatable** JSON/array field states *and* separate locale-suffixed columns such as `title_en`, `title_am`, `title_ru`.🧠 **Smart Suffix &amp; Layout Detection**Detects sibling locale fields inside **Tabs**, **Sections**, or any nested Filament layout. Uses Filament's **Set Utility** and Livewire state paths to populate related fields automatically.🔄 **Resilient AI Failover**If the primary Gemini model is under high demand, the package gracefully rotates through `gemini-2.5-flash`, `gemini-2.0-flash`, and `gemini-1.5-flash` to keep translations flowing.🎨 **Adaptive UI**Adds a sleek translate action as a **suffix** on affix-capable fields (`TextInput`, `Select`, …) or as a **hint** on complex editors like `RichEditor`.⚡ **Filament 4 &amp; 5 Ready**Built on the modern `Filament\Contracts\Plugin` architecture with a clean `->aiTranslate()` macro on any form `Field`.🔔 **Polished UX**Loading, success, and failure states are surfaced through native Filament notifications.---

📸 Demo
------

[](#-demo)

> Screenshot (recommended: Tab layout with `title_en` / `title_am` / `title_ru` fields).

 [![Filament AI Translator demo — translating fields inside a tabbed locale layout](docs/screenshot_other.png)](docs/screenshot_other.png)

 *Example: translate from the English tab and instantly populate Russian sibling fields.*

---

 [![Filament AI Translator demo — translating fields inside a tabbed locale layout](docs/screenshot_spatie.png)](docs/screenshot_spatie.png)

 *Example: Spatie translatable*

---

📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require martin6363/filament-ai-translator
```

Publish the configuration file:

```
php artisan vendor:publish --tag=filament-ai-translator-config
```

Publish the language files (optional — customize notification and action labels):

```
php artisan vendor:publish --tag=filament-ai-translator-translations
```

Register the plugin in your Filament panel provider:

```
use Martin6363\FilamentAiTranslator\FilamentAiTranslatorPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentAiTranslatorPlugin::make(),
        ]);
}
```

> **Note:** The package auto-registers via Laravel package discovery. You only need to add the plugin to your panel.

---

🔐 Environment Setup
-------------------

[](#-environment-setup)

Add your Google Gemini credentials to `.env`:

```
GEMINI_API_KEY=your-google-ai-studio-api-key
GEMINI_MODEL=gemini-2.0-flash
```

VariableRequiredDescription`GEMINI_API_KEY`**Yes**API key from [Google AI Studio](https://aistudio.google.com/apikey).`GEMINI_MODEL`NoPrimary model. Defaults to `gemini-2.0-flash`. Fallback models are tried automatically on high-demand errors.> **Security:** Never commit API keys to version control. Restrict keys in Google AI Studio, rotate them regularly, and use environment-specific secrets in production (e.g. encrypted env, vault, or CI secrets).

---

⚙️ Configuration
----------------

[](#️-configuration)

After publishing, customize `config/filament-ai-translator.php`:

```
