alessandrolandim/translation-bundle
.yml, .php) with a database-backed system. This aligns with Laravel’s Eloquent ORM but introduces schema dependencies (e.g., translation tables) that may conflict with existing migration strategies.trans() function would need to be extended or mocked to respect this hierarchy.translations table with locale, domain, message, translation fields).Translator facade to override Laravel’s default loader with a database-backed strategy.DatabaseLoader).GET /api/translations/{locale}) and build a separate frontend.lexik_translation.export) would need Laravel equivalents (e.g., custom events or observers).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Architectural Mismatch | High | Abstract Symfony components via adapters (e.g., Symfony Bridge for Laravel). |
| Schema Conflicts | Medium | Design a migration strategy to merge existing translation tables. |
| Performance Overhead | Medium | Benchmark database queries vs. file I/O. Cache translations aggressively (e.g., Redis). |
| GUI Reimplementation | High | Use Laravel admin packages (Filament, Nova) or build a lightweight Blade interface. |
| Dependency Bloat | Low | Isolate bundle dependencies (e.g., use symfony/translation directly). |
| Testing Complexity | Medium | Mock Symfony services in Laravel tests (e.g., partial mocks). |
symfony/translation) without full Symfony?symfony/translation directly (avoid full bundle).Translation).spatie/laravel-translatable or mcamara/laravel-localization for simpler needs.Phase 1: Proof of Concept (2-4 weeks)
symfony/translation and symfony/console as Laravel dependencies.Translation model matching the bundle’s schema.Translator service to load translations from the DB..yml files into the DB.messages.en.yml).trans() with fallback to files.Phase 2: GUI Integration (3-6 weeks)
TranslationResource).Phase 3: Full Replacement (4-8 weeks)
php artisan translation:export).messages, validation). Laravel’s trans() already handles domains—no changes needed.en → default) must be preserved or adapted.TranslationServiceProvider tests as a baseline; extend for DB-backed logic.| Priority | Task | Dependencies |
|---|---|---|
| 1 | Set up Eloquent Translation model and DB schema. |
- |
| 2 | Implement custom Translator to load from DB. |
Eloquent model |
| 3 | Build Artisan command for import/export. | symfony/console, Eloquent |
| 4 | Test core functionality (import + trans() retrieval). |
Steps 1-3 |
| 5 | Choose GUI approach (API/Blade) and prototype. | Step 4 |
| 6 | Integrate GUI with existing admin panel (e.g., Filament). | Step 5 |
| 7 | Add caching (Redis) for performance. | Step 6 |
| 8 | Deprecate file-based translations and migrate existing data. | All prior steps |
| 9 | Write documentation and rollout plan. | All prior steps |
How can I help you explore Laravel packages today?