Find Missing Translations with the Laravel Translations Checker

Packages

March 24th, 2022

Find Missing Translations with the Laravel Translations Checker

The Laravel Translations Checker package finds missing translations in the languages you support. Using this package is as easy as running an artisan CLI to check translations across all languages:

php artisan translations:check --excludedDirectories=vendor
 
The language nl (resources/lang/nl) is missing the file ( passwords.php )
Missing the translation with key: nl.passwords.reset
Missing the translation with key: nl.passwords.sent
Missing the translation with key: nl.passwords.throttled
Missing the translation with key: nl.passwords.token
Missing the translation with key: nl.passwords.user

This package supports looking for translations in both .php and .json translation files. Also, the readme has a nice example of checking for missing translations in a GitHub action:

translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
tools: php-cs-fixer, phpunit
- name: Install Dependencies
run: composer install -q --no-interaction --no-scripts
- name: Run translations check
run: php artisan translations:check --excludedDirectories=vendor

Here's an example of the output after adding a new language (es) to a new Laravel application:

Translation checker example output

Using this tool, you can quickly make sure you define translations for everything! To get started with this package, check out the README on GitHub at laravel-translations-checker.


This package was submitted to our Laravel News Links section. Links is a place the community can post packages and tutorials around the Laravel ecosystem. Follow along on Twitter @LaravelLinks

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.