Find Missing Translations with the Laravel Translations Checker


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:

1php artisan translations:check --excludedDirectories=vendor
3The language nl (resources/lang/nl) is missing the file ( passwords.php )
4Missing the translation with key: nl.passwords.reset
5Missing the translation with key: nl.passwords.sent
6Missing the translation with key: nl.passwords.throttled
7Missing the translation with key: nl.passwords.token
8Missing 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:

2 runs-on: ubuntu-latest
3 steps:
4 - uses: actions/checkout@v2
5 - name: Setup PHP
6 uses: shivammathur/setup-php@v2
7 with:
8 php-version: '8.0'
9 extensions: mbstring, intl
10 ini-values: post_max_size=256M, max_execution_time=180
11 coverage: xdebug
12 tools: php-cs-fixer, phpunit
13 - name: Install Dependencies
14 run: composer install -q --no-interaction --no-scripts
15 - name: Run translations check
16 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.