[Translator][warmup][fallback locales] fixed missing cache file generation.
This commit is contained in:
parent
6b08d3eb16
commit
cade651915
@ -273,7 +273,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
// prime the cache
|
||||
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir, 'resource_files' => $resourceFiles), 'yml');
|
||||
$translator->setLocale('fr');
|
||||
$translator->setFallbackLocales(array('fr'));
|
||||
$translator->warmup($this->tmpDir);
|
||||
|
||||
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
|
||||
@ -283,6 +283,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir, 'resource_files' => $resourceFiles), 'yml');
|
||||
$translator->setLocale('fr');
|
||||
$translator->setFallbackLocales(array('fr'));
|
||||
$this->assertEquals('répertoire', $translator->trans('folder'));
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,13 @@ class Translator extends BaseTranslator implements WarmableInterface
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->resourceLocales as $locale) {
|
||||
$locales = array_merge($this->getFallbackLocales(), array($this->getLocale()), $this->resourceLocales);
|
||||
foreach (array_unique($locales) as $locale) {
|
||||
// reset catalogue in case it's already loaded during the dump of the other locales.
|
||||
if (isset($this->catalogues[$locale])) {
|
||||
unset($this->catalogues[$locale]);
|
||||
}
|
||||
|
||||
$this->loadCatalogue($locale);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user