Commit 06edabe3 authored by Fabien Potencier's avatar Fabien Potencier

Merge branch '1.2'

* 1.2:
  fixed locale when changing it on the translator itself
  fixed switfmailer spool where the event dispatcher as different from the other ones

Conflicts:
	src/Silex/Provider/SwiftmailerServiceProvider.php
parents 4905c560 2dcb2b1e
......@@ -38,7 +38,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
};
$app['swiftmailer.spooltransport'] = function ($app) {
return new \Swift_SpoolTransport($app['swiftmailer.spool']);
return new \Swift_Transport_SpoolTransport($app['swiftmailer.transport.eventdispatcher'], $app['swiftmailer.spool']);
};
$app['swiftmailer.spool'] = function ($app) {
......
......@@ -35,4 +35,11 @@ class Translator extends BaseTranslator
{
return $this->app['locale'];
}
public function setLocale($locale)
{
$this->app['locale'] = $locale;
parent::setLocale($locale);
}
}
......@@ -128,4 +128,16 @@ class TranslationServiceProviderTest extends \PHPUnit_Framework_TestCase
$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