Skip to content

Commit ef0c287

Browse files
committed
[Translation] Fix the string casting in the XliffFileLoader
1 parent a0d131f commit ef0c287

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Loader/XliffFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function load($resource, $locale, $domain = 'messages')
5353
}
5454

5555
$source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source;
56-
$target = (string) isset($translation->target) ? $translation->target : $source;
56+
$target = (string) (isset($translation->target) ? $translation->target : $source);
5757

5858
// If the xlf file has another encoding specified, try to convert it because
5959
// simple_xml will always return utf-8 encoded values

Tests/Loader/XliffFileLoaderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function testLoad()
2525
$this->assertEquals('en', $catalogue->getLocale());
2626
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
2727
$this->assertSame(array(), libxml_get_errors());
28+
$this->assertContainsOnly('string', $catalogue->all('domain1'));
2829
}
2930

3031
public function testLoadWithInternalErrorsEnabled()

0 commit comments

Comments
 (0)