Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Filament Translation Component

Filament Translation Component Laravel Package

tomatophp/filament-translation-component

A FilamentPHP form component that renders translations as key/value fields, built to work with the Spatie Translatable plugin. Install via Composer, add Translation::make('title') to any form, and switch between input or textarea display.

View on GitHub
Deep Wiki
Context7

Filament Translation Component adds a key/value translation field to FilamentPHP forms, designed to work seamlessly with the Spatie Translatable plugin. Drop it into any form to let users edit a single field across multiple languages, with the available locales driven by your config file. It renders as a clean input by default and supports dark and light themes out of the box.

  • Spatie Translatable integration for multilingual fields
  • Switch between input and textarea rendering
  • Locale list configurable via the package config
  • Simple Translation::make('title') API
  • Light and dark mode support
composer require tomatophp/filament-translation-component
Frequently asked questions about Filament Translation Component
How do I add a translatable field to a Filament form using this package?
Use the `Translation` component in your Filament form like this: `Translation::make('title')->label('Title')`. This creates a translatable field tied to Spatie Translatable’s backend. Ensure your model uses `HasTranslations` and the `translations` table exists.
Does this package support FilamentPHP v4.x or only v3.x?
This package is explicitly designed for FilamentPHP v3.x. While no breaking changes exist in v4.0.1, Filament v4.x compatibility isn’t guaranteed. Test thoroughly if upgrading. Check the changelog for future updates.
Can I customize which languages are available for translation?
Yes, configure supported languages in the package’s config file (`config/filament-translation-component.php`). This overrides the default languages and applies to all translation fields in your Filament resources.
Will this work with Laravel 10/11 and Spatie Translatable v3.0+?
Absolutely. The package is fully compatible with Laravel 10/11 and Spatie Translatable v3.0+. No additional setup is required beyond installing the package and ensuring your models use `HasTranslations`.
How do I switch between input and textarea variants for translations?
The package provides both variants by default. Use `Translation::make()->input()` for short text or omit it for textarea (default). Example: `Translation::make('description')->input()` forces an input field.
Is there a performance impact when using this package in production?
No significant performance overhead is introduced. Translations are stored as key/value pairs in Spatie’s `translations` table, and the package leverages Filament’s existing caching mechanisms. Test with your dataset to confirm.
Can I use this for nested or complex translations (e.g., JSON structures)?
This package is designed for simple key/value translations via Spatie Translatable. For nested or JSON-based translations, consider alternatives like `spatie/laravel-translation-loader` or custom solutions. The package lacks built-in support for these use cases.
How do I handle fallback locales (e.g., default to English if Spanish is missing)?
Fallback locales are handled automatically by Spatie Translatable. Configure fallbacks in your model’s `getTranslationFallbacks()` method or use Spatie’s default fallback logic. The package doesn’t override this behavior.
What if I encounter issues with form state updates after installing this package?
The package fixed a state update bug in v4.0.1. If issues persist, verify your Filament resource’s form submission logic and ensure you’re using the latest version. Test with a minimal resource to isolate the problem.
Are there alternatives if I need more advanced translation features (e.g., dynamic content)?
For dynamic or content-heavy translations, consider Laravel Nova’s built-in translations or `spatie/laravel-translation-loader` for JSON-based storage. This package is optimized for Filament’s UI-localization needs, not large-scale content management.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle