Laravel Translations Documentation
Welcome to the Laravel Translations package documentation. This package provides comprehensive translation management for Laravel applications with support for multiple translation providers and automatic model attribute translation.
Quick Navigation
- Installation & Setup - Get started quickly
- Configuration - Configure the package
- Basic Usage - Core translation features
- Model Attributes - Translate Eloquent model attributes
- Translation Providers - Google Translate, DeepL, AI providers
- Commands - Artisan commands reference
- Advanced Usage - Advanced features and customization
What This Package Does
Laravel Translations is a powerful package that:
- Scans your Laravel application for translation strings using
trans()
,__()
, and other Laravel translation functions - Manages multiple languages with support for locale-specific variants (e.g.,
en-US
,fr-BE
) - Translates automatically using Google Translate, DeepL, or AI providers
- Handles model attributes - automatically translate Eloquent model attributes
- Syncs translations - keeps your translations in sync across languages
- Caches efficiently - optional permanent caching for better performance
Key Features
- 🌐 Multiple Translation Providers: Google Translate, DeepL, AI (OpenAI, etc.)
- 🔄 Automatic Scanning: Finds translation strings in your codebase
- 🏷️ Model Attributes: Translate Eloquent model attributes automatically
- 📊 Language Management: Add, remove, and manage languages easily
- ⚡ Performance: Optional caching and queued operations
- 🎯 Laravel Integration: Seamless integration with Laravel's translation system
Quick Start
Install the package:
bashcomposer require backstage/laravel-translations
Publish and run migrations:
bashphp artisan vendor:publish --provider="Backstage\Translations\Laravel\TranslationServiceProvider" php artisan migrate
Add a language:
bashphp artisan translations:languages:add en English
Scan for translations:
bashphp artisan translations:scan
Translate them:
bashphp artisan translations:translate
That's it! Your translations are now managed automatically.
Need Help?
- Look at the Advanced Usage for complex scenarios
This documentation covers Laravel Translations v1.x. For older versions, please refer to the appropriate version tag.