Overview
Thetranslate command automatically translates missing translation keys from your base language to one or more target languages using AI.
Syntax
Options
Use a faster LLM model for translations. This option sacrifices some precision for improved speed.
Enable interactive mode. This allows you to review and re-translate each file individually, with the option to re-translate files even when no missing keys are found.
Skip specific translation files. Provide a comma-separated list of file names to exclude from translation.Example:
--skip-names=validation,paginationSkip specific target languages. Provide a comma-separated list of language codes to exclude from translation.Example:
--skip-languages=fr,deTranslate only specific file(s). Provide a comma-separated list of file names (without extension) to translate.Example:
--name=messages,validationTranslate to specific language(s) only. Provide a comma-separated list of language codes.Example:
--language=es,fr,deThe source language to translate from. Defaults to the
app.locale configuration value.Example: --base-language=enInternal option for resuming translations after a specific point.
Custom base path for translation files. Defaults to Laravel’s
lang_path() directory.Example: --lang-dir=/custom/path/langExamples
Output Example
Behavior
- Missing Keys Detection: The command automatically detects which translation keys exist in your base language but are missing in target languages
- Chunked Processing: Translations are processed in chunks with automatic retries (up to 3 attempts)
- Progress Tracking: Real-time progress bars show translation progress for each file
- No Missing Keys: When no missing keys are found, the file is skipped (unless in interactive mode)
- Automatic Writing: Translated keys are automatically merged with existing translations and written to disk
The command preserves existing translations and only adds missing keys. It will never overwrite existing translation values unless you explicitly re-translate in interactive mode.
Related Commands
- translate:validate - Check for missing translation keys