- 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.