[Translation] Fix the string casting in the XliffFileLoader

This commit is contained in:
Christophe Coevoet 2015-08-26 11:54:34 +02:00
parent fed77a3d80
commit b856f62cd4
2 changed files with 2 additions and 1 deletions

View File

@ -53,7 +53,7 @@ class XliffFileLoader implements LoaderInterface
}
$source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source;
$target = (string) isset($translation->target) ? $translation->target : $source;
$target = (string) (isset($translation->target) ? $translation->target : $source);
// If the xlf file has another encoding specified, try to convert it because
// simple_xml will always return utf-8 encoded values

View File

@ -25,6 +25,7 @@ class XliffFileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('en', $catalogue->getLocale());
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
$this->assertSame(array(), libxml_get_errors());
$this->assertContainsOnly('string', $catalogue->all('domain1'));
}
public function testLoadWithInternalErrorsEnabled()