[Translation] avoid creating cache files for fallback locales.
This commit is contained in:
parent
85ae039cd0
commit
22425b2692
@ -149,6 +149,17 @@ class TranslatorCacheTest extends TestCase
|
||||
$this->assertEquals('OK', $translator->trans($msgid), '-> the cache was overwritten by another translator instance in '.($debug ? 'debug' : 'production'));
|
||||
}
|
||||
|
||||
public function testGeneratedCacheFilesAreOnlyBelongRequestedLocales()
|
||||
{
|
||||
$translator = new Translator('a', null, $this->tmpDir);
|
||||
$translator->setFallbackLocales(array('b'));
|
||||
$translator->trans('bar');
|
||||
|
||||
$cachedFiles = glob($this->tmpDir.'/*.php');
|
||||
|
||||
$this->assertCount(1, $cachedFiles);
|
||||
}
|
||||
|
||||
public function testDifferentCacheFilesAreUsedForDifferentSetsOfFallbackLocales()
|
||||
{
|
||||
/*
|
||||
|
@ -420,7 +420,7 @@ EOF
|
||||
|
||||
foreach ($this->computeFallbackLocales($locale) as $fallback) {
|
||||
if (!isset($this->catalogues[$fallback])) {
|
||||
$this->loadCatalogue($fallback);
|
||||
$this->initializeCatalogue($fallback);
|
||||
}
|
||||
|
||||
$fallbackCatalogue = new MessageCatalogue($fallback, $this->catalogues[$fallback]->all());
|
||||
|
Reference in New Issue
Block a user