Codecov Test coverage

Check Laravel translation files for missing translations.

This package scans your Laravel translation files and reports:

  • Missing translation files across languages
  • Translation keys that exist in one language but not others
  • Empty or blank translation values

Requirements

This package requires PHP 8.2+ and Laravel 11.0+.

Installation

You can install the package via composer:

composer require sertxudeveloper/laravel-translations-checker

Usage

Run the check command to scan your translation files:

php artisan translations:check

By default, it checks the lang directory in your application. You can specify a different directory:

php artisan translations:check --directory=resources/lang

The command returns exit code 1 if any issues are found, making it suitable for CI/CD pipelines.

Example output

Missing translations:
 - The language es (resources/lang/es) is missing the file (auth.php)
 - es.validation.required

Empty translations:
 - en.messages.welcome (empty value)

Using the Service

You can also use the underlying service in your own code:

use SertxuDeveloper\TranslationsChecker\Services\TranslationCheckerService;

$checker = app(TranslationCheckerService::class);
$result = $checker->check(resource_path('lang'));

$result['missingFiles'];        // Files missing in some languages
$result['missingTranslations']; // Keys missing in some languages
$result['emptyTranslations'];   // Keys with empty values