diff --git a/src/Mcamara/LaravelLocalization/LaravelLocalization.php b/src/Mcamara/LaravelLocalization/LaravelLocalization.php index 228ece5..7052929 100644 --- a/src/Mcamara/LaravelLocalization/LaravelLocalization.php +++ b/src/Mcamara/LaravelLocalization/LaravelLocalization.php @@ -194,6 +194,7 @@ public function setLocale($locale = null) } $this->app->setLocale($this->currentLocale); + $this->translator->setLocale($this->currentLocale); // Regional locale such as de_DE, so formatLocalized works in Carbon $regional = $this->getCurrentLocaleRegional(); diff --git a/tests/CustomTranslatorTest.php b/tests/CustomTranslatorTest.php new file mode 100644 index 0000000..8bb7f1e --- /dev/null +++ b/tests/CustomTranslatorTest.php @@ -0,0 +1,33 @@ +app, + $this->app['config'], + $translator, + $this->app['router'], + $this->app['request'], + $this->app['url'] + ); + + $localization->setLocale('es'); + + $this->assertEquals('es', $translator->getLocale()); + } +}