Skip to main content
The translate command offers several advanced options for power users who need precise control over the translation process.

Fast Mode

Use a faster, more cost-effective LLM model with the --fast flag:
php artisan translate --fast

When to Use Fast Mode

Development

Quick translations during development and testing

Large Projects

Translating many files to reduce costs and time

Draft Translations

Creating initial drafts for human review

Simple Content

Translating straightforward, non-critical text
Fast mode uses a less precise model. Review the output carefully for important or customer-facing content.

Fast Mode Trade-offs

Advantages:
  • Faster translation speed
  • Lower API costs
  • Good for bulk operations
Disadvantages:
  • Less contextual accuracy
  • May miss nuanced meanings
  • Not ideal for marketing or legal content

Combining Fast Mode with Interactive Mode

php artisan translate --fast --interactive
This combination lets you:
  • Generate quick initial translations
  • Review and refine results interactively
  • Iterate rapidly during development

Skip Options

Skip Specific Files

Exclude certain language files from translation with --skip-names:
php artisan translate --skip-names=auth,passwords
Multiple files can be skipped by separating them with commas:
php artisan translate --skip-names=auth,passwords,validation
Use cases:
  • Skip files you’ve already manually translated
  • Exclude files with highly technical or specialized terminology
  • Avoid files that are managed by another team or process

Skip Specific Languages

Exclude certain target languages with --skip-languages:
php artisan translate --skip-languages=cn,jp
Skip multiple languages:
php artisan translate --skip-languages=cn,jp,kr
Use cases:
  • Skip languages handled by professional translators
  • Exclude languages pending review
  • Avoid languages with special requirements
The skip options are applied after the --name and --language options, giving you fine-grained control over what gets translated.

Custom Language Directory

Specify a custom location for your translation files with --lang-dir:
php artisan translate --lang-dir=/custom/path/to/lang

When to Use Custom Language Directory

Package Development:
php artisan translate --lang-dir=/packages/my-package/lang
Multi-tenant Applications:
php artisan translate --lang-dir=/tenants/acme-corp/lang
Testing:
php artisan translate --lang-dir=/tests/fixtures/lang
The --lang-dir option works with both the translate and translate:validate commands.

Default Behavior

Without the --lang-dir option, the package uses Laravel’s standard lang_path(), which defaults to:
  • Laravel 9+: lang/ directory in project root
  • Laravel 8 and below: resources/lang/

Advanced Flag Combinations

Selective Translation Workflow

Translate specific files while skipping others:
php artisan translate \
  --language=fr,es,de \
  --skip-names=auth,passwords \
  --fast
This translates:
  • To French, Spanish, and German
  • All files except auth and passwords
  • Using fast mode for speed

Package-Specific Translation

Translate a package’s language files:
php artisan translate \
  --lang-dir=/packages/my-package/lang \
  --name=validation \
  --language=en,fr

Production-Ready Workflow

Translate critical files with quality control:
php artisan translate \
  --name=marketing,legal,emails \
  --skip-languages=cn \
  --interactive
This workflow:
  • Focuses on critical domains
  • Skips Chinese (handled externally)
  • Uses interactive mode for quality control

Development Workflow

Quick translations for development:
php artisan translate \
  --fast \
  --skip-names=passwords,auth

Undocumented Internal Options

The package includes some internal options that are generally not needed:

—after

php artisan translate --after=2024-01-01
This is an internal option and not fully implemented. It’s not recommended for production use.

Command Reference

All Available Options

Here’s the complete list of options for the translate command:
OptionTypeDescription
--namestringTranslate specific files (comma-separated)
--languagestringTranslate to specific languages (comma-separated)
--base-languagestringSource language (defaults to app.locale)
--fastflagUse faster, less precise LLM
--interactiveflagEnable interactive re-translation prompts
--skip-namesstringSkip specific files (comma-separated)
--skip-languagesstringSkip specific languages (comma-separated)
--lang-dirstringCustom translation directory path

Validation Command Options

OptionTypeDescription
--namestringValidate specific files (comma-separated)
--languagestringValidate specific languages (comma-separated)
--base-languagestringSource language for validation
--lang-dirstringCustom translation directory path
--verbose / -vflagShow detailed output with missing key tables

Best Practices

1

Start with validation

php artisan translate:validate --verbose
Identify what needs translation
2

Use fast mode for bulk work

php artisan translate --fast
Generate initial translations quickly
3

Refine critical content

php artisan translate --name=marketing,legal --interactive
Use interactive mode without fast flag for quality
4

Validate results

php artisan translate:validate
Confirm all translations are complete

Performance Tips

Parallel Processing

The package processes translations sequentially, so:
  • Translate different language sets in separate terminal sessions
  • Use --language to split work across multiple commands
  • Consider background jobs for large translation tasks

Cost Optimization

# Use fast mode for development
php artisan translate --fast --skip-languages=cn,jp

# Use standard mode for production
php artisan translate --name=marketing --interactive

Time Optimization

Use skip options to avoid re-translating files that haven’t changed:
php artisan translate --skip-names=auth,passwords,validation

Next Steps

Basic Translation

Return to basic translation guide

Configuration

Configure LLM providers and settings

Build docs developers (and LLMs) love