[Translation] Add XLIFF 1 source to metadata to differentiate from attr

This commit is contained in:
Gabriel Ostrolucký 2019-03-07 09:54:57 +01:00
parent f8664e7703
commit ab04f25da4
No known key found for this signature in database
GPG Key ID: 0B618B95BA22CEEF
3 changed files with 9 additions and 2 deletions

View File

@ -105,6 +105,7 @@ class XliffFileLoader implements LoaderInterface
$catalogue->set((string) $source, $target, $domain);
$metadata = [
'source' => (string) $translation->source,
'file' => [
'original' => (string) $fileAttributes['original'],
],

View File

@ -86,6 +86,7 @@ class XliffFileLoaderTest extends TestCase
$this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1'));
$this->assertEquals(
[
'source' => 'foo',
'notes' => [['content' => utf8_decode('bäz')]],
'id' => '1',
'file' => [
@ -175,6 +176,7 @@ class XliffFileLoaderTest extends TestCase
$this->assertEquals(
[
'source' => 'foo',
'notes' => [['priority' => 1, 'content' => 'foo']],
'id' => '1',
'file' => [
@ -186,6 +188,7 @@ class XliffFileLoaderTest extends TestCase
// message without target
$this->assertEquals(
[
'source' => 'extrasource',
'notes' => [['content' => 'bar', 'from' => 'foo']],
'id' => '2',
'file' => [
@ -197,6 +200,7 @@ class XliffFileLoaderTest extends TestCase
// message with empty target
$this->assertEquals(
[
'source' => 'key',
'notes' => [
['content' => 'baz'],
['priority' => 2, 'from' => 'bar', 'content' => 'qux'],
@ -304,6 +308,7 @@ class XliffFileLoaderTest extends TestCase
$this->assertEquals(
[
'source' => 'foo',
'id' => '1',
'file' => [
'original' => 'file.ext',
@ -313,6 +318,7 @@ class XliffFileLoaderTest extends TestCase
);
$this->assertEquals(
[
'source' => 'test',
'notes' => [['content' => 'note']],
'id' => '4',
'file' => [

View File

@ -7,8 +7,8 @@
<target>bar</target>
<note priority="1">foo</note>
</trans-unit>
<trans-unit id="2">
<source>extra</source>
<trans-unit id="2" resname="extra">
<source>extrasource</source>
<note from="foo">bar</note>
</trans-unit>
<trans-unit id="123">