Commit 46b0535c authored by Fabien Potencier's avatar Fabien Potencier

fixed locale when changing it on the translator itself

parent 8d2140c0
...@@ -34,4 +34,11 @@ class Translator extends BaseTranslator ...@@ -34,4 +34,11 @@ class Translator extends BaseTranslator
{ {
return $this->app['locale']; return $this->app['locale'];
} }
public function setLocale($locale)
{
$this->app['locale'] = $locale;
parent::setLocale($locale);
}
} }
...@@ -135,4 +135,16 @@ class TranslationServiceProviderTest extends \PHPUnit_Framework_TestCase ...@@ -135,4 +135,16 @@ class TranslationServiceProviderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('The german translation', $app['translator']->trans('key1')); $this->assertEquals('The german translation', $app['translator']->trans('key1'));
} }
public function testChangingLocaleViaTranslator()
{
$app = $this->getPreparedApp();
$this->assertEquals('The translation', $app['translator']->trans('key1'));
$app['translator']->setLocale('de');
$this->assertEquals('The german translation', $app['translator']->trans('key1'));
$this->assertEquals('de', $app['locale']);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment