diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php index b3df0339b32b1..1da8faea5433d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php @@ -122,6 +122,12 @@ public function testLoadRessourcesWithCaching() $translator->setLocale('fr'); $this->assertEquals('répertoire', $translator->trans('folder')); + + // refresh cache when resources is changed in debug mode. + $translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir, 'debug' => true), array(), 'yml'); + $translator->setLocale('fr'); + + $this->assertEquals('folder', $translator->trans('folder')); } public function testLoadRessourcesWithoutCaching() diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php index 8e9843931d500..3d0f2b04e19f7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php @@ -63,6 +63,18 @@ public function __construct(ContainerInterface $container, MessageSelector $sele parent::__construct(null, $selector, $this->options['cache_dir'], $this->options['debug']); } + /** + * {@inheritdoc} + */ + protected function loadCatalogue($locale) + { + if (null !== $this->options['cache_dir'] && $this->options['debug']) { + $this->loadResources($locale); + } + + parent::loadCatalogue($locale); + } + /** * {@inheritdoc} */