sentry-laravel
sentry-laravel copied to clipboard
Report missing translations
Problem Statement
I just stumble upon a feature in the documentation of Laravel 10 that allows us to perform any action when the framework encounter a missing translation.
Solution Brainstorm
To be able to report a missing translation by opt-in for Sentry to catch it:
// app/Providers/AppServiceProvider.php
public function boot(): void
{
Lang::handleMissingKeysUsing(function (string $key, array $replacements, string $locale) {
Sentry::reportMissingTranslation($key, $replacements, $locale);
return $key;
});
}