3 namespace Carbon\Laravel
;
6 use Illuminate\Events\EventDispatcher
;
7 use Symfony\Component\Translation\Translator
;
9 class ServiceProvider
extends \Illuminate\Support\ServiceProvider
11 public function boot()
14 if (($events = $this->app
['events']) instanceof EventDispatcher
) {
15 $events->listen(version_compare($this->app
->version(), '5.5') >= 0 ?
'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function () use ($service) {
16 $service->updateLocale();
18 $service->updateLocale();
22 public function updateLocale()
24 if (($translator = $this->app
['translator']) instanceof Translator
) {
25 Carbon
::setLocale($translator->getLocale());