translate command is the primary tool for translating your Laravel application’s language files using AI. It intelligently detects missing translations and generates contextually appropriate translations for your target languages.
Basic Usage
Run the translate command without any options to translate all configured languages:Detect missing translations
The command compares your source language files with target language files to identify missing keys.
Generate translations with AI
Uses your configured LLM to generate contextually appropriate translations.
Example Output
Here’s what you’ll see when running the translate command:Translate Specific Files
Use the--name option to translate only specific language files:
Translate to Specific Languages
Use the--language option to translate to specific target languages only:
Change Source Language
By default, the package uses your application’s locale (fromconfig/app.php) as the source language. You can override this with the --base-language option:
Combining Options
You can combine multiple options for precise control:- Only translate the
authlanguage file - Only translate to French and Spanish
- Use English as the source language
How It Works
The translation system provides the complete source and target language files to the LLM for full context. This ensures consistency in terminology and style across your application.
- Context Loading: Both source and target language files are loaded into memory with their full nested structure
- Missing Key Detection: The system compares files to identify which translations are missing
- AI Translation: The LLM receives complete context and returns only the missing translations using dot notation
- Smart Merging: New translations are merged into existing files without regenerating everything
- Add new languages without starting from scratch
- Update existing translations incrementally
- Maintain manual edits and customizations
Next Steps
Interactive Mode
Learn how to refine translations interactively
Advanced Options
Explore advanced flags for power users