Struggling to keep your multilingual Laravel application's translations up-to-date? Casper Bottelet's Translation Checker is the solution. This package scans your project's code for strings that need translation and compares them to your language files. If it finds a missing translation key, it will add it with an empty value, making it easy for you to fill in the correct translation. What is also nice about this package is that even though it works with Laravel, it supports various frontend frameworks like Vue.js, React, and Svelte as well.
To install this package, run:
composer require bottelet/translation-checker --dev
Next you can use the versatile check
command to
check, manage, and update translations:
php artisan translations:check en
The Translation Checker can also be configured to use translation services (from Google, OpenAI or DeepL), specify source paths, and define the language folder. You can publish a configuration file with the following command:
php artisan vendor:publish --provider="Bottelet\TranslationChecker\TranslationCheckerServiceProvider"
The package has some additional commands that you can also use:
translations:clean
- Will clean translations by removing unused keystranslations:find-missing
- Will find and add any missing translationstranslations:sort
- Will sort your translation filestranslations:sync
- Will sync translations between language files
Learn more about this package by reading the documentation and view the source code on Github at Bottelet/translation-checker.
The post Translation Checker appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.