Skip to content

Commit

Permalink
Merge pull request #22 from philbates35/remove-handle-missing-lang
Browse files Browse the repository at this point in the history
Translation: Don't use Lang::handleMissingKeysUsing
  • Loading branch information
philbates35 authored Feb 15, 2024
2 parents 7b71bab + 2b9c421 commit abde0b3
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\ServiceProvider;
use Illuminate\Translation\Translator;
use OutOfBoundsException;
use Override;

class AppServiceProvider extends ServiceProvider
Expand All @@ -21,19 +18,7 @@ class AppServiceProvider extends ServiceProvider
#[Override]
public function register(): void
{
$this->app->resolving('translator', function (Translator $translator): void {
$translator->handleMissingKeysUsing(function (string $key): string {
$message = "Missing translation key [{$key}] detected.";

if (!$this->isProduction()) {
throw new OutOfBoundsException($message);
}

Log::warning($message);

return $key;
});
});
//
}

/**
Expand Down

0 comments on commit abde0b3

Please sign in to comment.