Skip to main content

Overview

The translate:validate command checks your translation files for missing keys by comparing target languages against your base language. It provides a comprehensive overview of translation coverage.

Syntax

php artisan translate:validate [options]

Options

--name
string
Validate only specific translation file(s). Provide a comma-separated list of file names (without extension).Example: --name=messages,validation
--language
string
Validate specific language(s) only. Provide a comma-separated list of language codes.Example: --language=es,fr,de
--base-language
string
The source language to compare against. Defaults to the app.locale configuration value.Example: --base-language=en
--lang-dir
string
Custom base path for translation files. Defaults to Laravel’s lang_path() directory.Example: --lang-dir=/custom/path/lang
-v, --verbose
flag
Display detailed output including all missing keys with their values. Without this flag, only a summary table is shown.

Examples

php artisan translate:validate

Output Examples

Summary View (Default)

Checking translations...
Source: en
Languages: es, fr, de
Domains: messages, validation

┌─────────────────────┬──────────────┐
 Domain Missing Keys
├─────────────────────┼──────────────┤
 de/messages
 de/validation 3
 es/messages
 es/validation
 fr/messages 5
 fr/validation
└─────────────────────┴──────────────┘

Verbose Output

Checking translations...
Source: en
Languages: es, fr
Domains: messages

Checking messages...

Checking messages in es...

 Missing translations for `messages` in `es`:
┌──────────────────────────┬─────────────────────────────────────┐
 Key Value
├──────────────────────────┼─────────────────────────────────────┤
 welcome.title Welcome to our application
 welcome.subtitle Start your journey with us
 dashboard.greeting Hello, :name!
└──────────────────────────┴─────────────────────────────────────┘

Checking messages in fr...

 No missing translations for messages in fr

Understanding the Output

Status Indicators

  • ✔ (Green checkmark): All translations are present for this domain/language combination
  • Number (Red): The count of missing translation keys
  • – (Red dash): The translation file doesn’t exist at all

Verbose Mode Details

When using the --verbose flag, you’ll see:
  • Individual progress for each domain and language
  • Tables showing each missing key alongside its value in the base language
  • Keys are limited to 100 characters for display
  • Values are limited to 70 characters for display
The validate command only checks for missing keys. It does not verify the quality or accuracy of existing translations.

Use Cases

CI/CD Integration

Use this command in your continuous integration pipeline to ensure translations are complete:
php artisan translate:validate || exit 1

Pre-Deployment Check

Run validation before deploying to production to catch missing translations:
php artisan translate:validate --verbose

Focused Validation

Check specific files or languages when working on particular features:
php artisan translate:validate --name=messages --language=es,fr
  • translate - Automatically translate missing keys

Build docs developers (and LLMs) love