bottelet/translation-checker
Laravel dev tool to scan your code for translation strings, detect missing keys in lang files (JSON/PHP), and sync them across locales. Optionally use AI to auto-translate missing entries; otherwise adds null placeholders to keep files consistent.
By default, this package scans .blade.php and .php files for translation function calls. However, if you have implemented translation functions in other file types such as JavaScript (.js) or Vue (.vue)
the package will automatically fallback to the RegexExtractor.
This allows you to extract translation strings from any file type using regular expressions.
You can extend the RegexExtractor to match your custom translation functions by adding custom regex patterns.
This is done by binding a new instance of RegexExtractor in your AppServiceProvider and defining your patterns using the addPattern method.
Suppose you have a custom translation function called myTranslateFunction() in your JavaScript files.
You can configure the RegexExtractor like this:
use App\Providers\AppServiceProvider;
use Vendor\Package\Extractors\RegexExtractor;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
app()->bind(RegexExtractor::class, function () {
return (new RegexExtractor)
->addPattern(
regex: '/myTranslateFunction\((["\'])(.*?)\1\)/',
matchIndex: 2,
group: 'myTranslateFunction'
);
});
}
}
This pattern will match instances like:
myTranslateFunction('Hello, world!')
Parameters Explained
How can I help you explore Laravel packages today?