Fixed for allowing empty translation.
This commit is contained in:
parent
58b924533a
commit
dd601662ea
@ -105,6 +105,6 @@ class PoFileLoader extends ArrayLoader implements LoaderInterface
|
||||
}
|
||||
fclose($stream);
|
||||
|
||||
return array_filter($messages);
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
@ -54,4 +54,15 @@ class PoFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('en', $catalogue->getLocale());
|
||||
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
|
||||
}
|
||||
|
||||
public function testLoadEmptyTranslation()
|
||||
{
|
||||
$loader = new PoFileLoader();
|
||||
$resource = __DIR__.'/../fixtures/empty-translation.po';
|
||||
$catalogue = $loader->load($resource, 'en', 'domain1');
|
||||
|
||||
$this->assertEquals(array('foo' => ''), $catalogue->all('domain1'));
|
||||
$this->assertEquals('en', $catalogue->getLocale());
|
||||
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
|
||||
}
|
||||
}
|
||||
|
3
src/Symfony/Component/Translation/Tests/fixtures/empty-translation.po
vendored
Normal file
3
src/Symfony/Component/Translation/Tests/fixtures/empty-translation.po
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
msgid "foo"
|
||||
msgstr ""
|
||||
|
Reference in New Issue
Block a user