[FrameworkBundle][Translation][debug mode] refresh cache when resources is changed.
This commit is contained in:
parent
d1131dbf93
commit
e36f1a70e1
@ -122,6 +122,12 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
$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()
|
||||
|
@ -63,6 +63,18 @@ class Translator extends BaseTranslator
|
||||
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}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user