Download the PHP package rodrigofs/filament-smart-translate without Composer
On this page you can find all versions of the php package rodrigofs/filament-smart-translate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rodrigofs/filament-smart-translate
More information about rodrigofs/filament-smart-translate
Files in rodrigofs/filament-smart-translate
Package filament-smart-translate
Short Description A comprehensive Laravel package for automatic translation support in Filament v4 applications with advanced fallback strategies.
License MIT
Homepage https://github.com/rodrigofs
Informations about the package filament-smart-translate
Filament Smart Translation
Complete translation solution for Filament v4 that provides automatic translation for all components with zero configuration, plus a powerful translation management interface for development.
✨ Features
- 🎯 Zero Configuration: Form fields, columns, actions work instantly
- 🔧 Simple Traits: Resources, Pages, Clusters need one line of code
- 🎛️ Smart Fallbacks: Intelligent fallback strategies when translations are missing
- 📱 Translation Manager: Built-in interface to manage translations (development mode)
- 🌐 Multi-locale Support: Full Laravel translation system support
- 📊 Status Dashboard: Visual overview of implementation status
- ⚡ High Performance: Optimized with caching and lazy evaluation
📦 Installation
1. Install Package
2. Publish Configuration (Optional)
3. Check Status
🚀 Quick Start
1. Set Your Locale
2. Create Translation Files
3. Add Traits to Resources, Pages & Clusters
Only for Resources, Pages, and Clusters - other components work automatically:
That's it! Your Filament interface will now display translated labels automatically.
🎯 How It Works
✅ Automatic (No Code Changes)
These components work instantly with zero configuration:
- Form Fields: TextInput, Select, Checkbox, etc.
- Table Columns: TextColumn, BooleanColumn, etc.
- Actions: CreateAction, EditAction, DeleteAction, etc.
- Layout: Section, Tabs, Group, etc.
🔧 Trait Required
These components need one trait per class:
- Resources: Model labels & navigation →
ResourceTranslateble - Pages: Navigation groups →
PageTranslateble - Clusters: Breadcrumbs & navigation →
ClusterTranslateble
| Component | Automatic | Trait Required |
|---|---|---|
| Form Fields | ✅ Yes | ❌ No |
| Table Columns | ✅ Yes | ❌ No |
| Actions | ✅ Yes | ❌ No |
| Layout | ✅ Yes | ❌ No |
| Resources | ❌ No | ✅ Yes |
| Pages | ❌ No | ✅ Yes |
| Clusters | ❌ No | ✅ Yes |
📱 Translation Manager (Development Feature)
The package includes a powerful translation management interface for development environments.
⚠️ Important: Development Only
The Translation Manager should only be used in development environments to avoid Git conflicts during production deployments.
The Problem: The manager modifies JSON translation files directly. When you pull updates from Git to your production server, these local changes will conflict with incoming changes, potentially causing deployment failures or requiring manual conflict resolution during git pull operations.
use Filament\Pages\Page;use Rodrigofs\FilamentSmartTranslate\Traits\Page\PageTranslateble;
🔧 Enable Translation Manager
1. Register the Plugin
Add the TranslationPlugin to your Filament panel:
2. Configure the Translation Manager
Add to your configuration:
📸 Translation Manager Features
Translation Manager interface showing the translation editing capabilities
🌐 Multi-language Interface
- Switch between locales instantly
- Add, edit, delete translations
- Bulk operations for efficiency
📊 Statistics Dashboard
- Total translations count
- Empty translations detection
- Progress tracking per locale
💾 Backup & Export
- Automatic backups before changes
- Export translations to JSON
- Safe file handling
🔍 Search Functionality
- Search translations by key or value
🛡️ Production Alternative
If you must use the Translation Manager in production:
-
Remove translation files from Git tracking:
-
Configure for production:
- Use environment variable:
⚠️ Recommendation: Keep the Translation Manager in development only to avoid Git conflicts during production deployments (git pull operations).
🎛️ Fallback Strategies
When translations are missing, the package applies intelligent fallback strategies:
Built-in Strategies
1. original (Default)
Keeps the original key format:
2. humanize
Converts to human-readable format:
3. lower_case
Converts to lowercase with hyphens:
Component-Specific Configuration
Custom Strategies
Create your own fallback strategy:
Register in configuration:
🌍 Translation Structure
Recommended: Component-Prefixed Keys
Alternative: Direct Keys
Resolution Order
- Component-prefixed key (
resources.user) - Direct key (
user) - Fallback strategy result
📊 Status Command
Get a complete overview of your setup:
Shows:
- ✅ Package status (enabled/disabled)
- 🎯 Trait usage (Resources, Pages, Clusters)
- ⚠️ Missing trait candidates
- 🔧 Component coverage with strategies
- 📊 Overall statistics and tips
Example output:
💡 Complete Example
Resource with Translation Trait
Translation File
Result: Complete Portuguese interface with intelligent fallbacks!
🔧 Configuration
Full configuration options:
🔧 Troubleshooting
Translations Not Showing?
- Check locale: Verify
config/app.phplocale setting - Clear cache: Run
php artisan config:clear - Add traits: Resources/Pages/Clusters need traits
- Check files: Ensure translation files exist
- Run status: Use
php artisan filament-smart-translate:status
Resources/Pages/Clusters Not Translating?
Add the required traits:
Translation Manager Not Working?
- Register the plugin: Add
TranslationPlugin::make()to your Filament panel - Enable in config: Set
translation_page.enabled => true - Check authorization: Verify
authorizecallback - Development mode: Ensure you're in development environment
- Clear cache: Run
php artisan config:clear
Git Conflicts During Production Deployment?
The Issue: Translation Manager changes create local modifications that conflict with git pull during production updates.
Recommended Solution: Use Translation Manager only in development.
Alternative for Production Use: Remove translation files from Git tracking:
📖 Requirements
- PHP: 8.2+
- Laravel: 11+
- Filament: 4.0+
🤝 Contributing
- Fork the repository
- Create your feature branch
- Run tests:
composer test - Submit a pull request
📝 License
MIT License - see LICENSE file.
🙏 Acknowledgements
- Filament Team: For the amazing admin framework
- Laravel Team: For the solid foundation
- Community: For feedback and contributions
Made with ❤️ for the Filament community
All versions of filament-smart-translate with dependencies
filament/filament Version ^v4.0
spatie/laravel-package-tools Version ^1.15.0