[Translation] Add XLIFF 1 source to metadata to differentiate from attr
This commit is contained in:
parent
f8664e7703
commit
ab04f25da4
@ -105,6 +105,7 @@ class XliffFileLoader implements LoaderInterface
|
|||||||
$catalogue->set((string) $source, $target, $domain);
|
$catalogue->set((string) $source, $target, $domain);
|
||||||
|
|
||||||
$metadata = [
|
$metadata = [
|
||||||
|
'source' => (string) $translation->source,
|
||||||
'file' => [
|
'file' => [
|
||||||
'original' => (string) $fileAttributes['original'],
|
'original' => (string) $fileAttributes['original'],
|
||||||
],
|
],
|
||||||
|
@ -86,6 +86,7 @@ class XliffFileLoaderTest extends TestCase
|
|||||||
$this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1'));
|
$this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1'));
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
[
|
[
|
||||||
|
'source' => 'foo',
|
||||||
'notes' => [['content' => utf8_decode('bäz')]],
|
'notes' => [['content' => utf8_decode('bäz')]],
|
||||||
'id' => '1',
|
'id' => '1',
|
||||||
'file' => [
|
'file' => [
|
||||||
@ -175,6 +176,7 @@ class XliffFileLoaderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
[
|
[
|
||||||
|
'source' => 'foo',
|
||||||
'notes' => [['priority' => 1, 'content' => 'foo']],
|
'notes' => [['priority' => 1, 'content' => 'foo']],
|
||||||
'id' => '1',
|
'id' => '1',
|
||||||
'file' => [
|
'file' => [
|
||||||
@ -186,6 +188,7 @@ class XliffFileLoaderTest extends TestCase
|
|||||||
// message without target
|
// message without target
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
[
|
[
|
||||||
|
'source' => 'extrasource',
|
||||||
'notes' => [['content' => 'bar', 'from' => 'foo']],
|
'notes' => [['content' => 'bar', 'from' => 'foo']],
|
||||||
'id' => '2',
|
'id' => '2',
|
||||||
'file' => [
|
'file' => [
|
||||||
@ -197,6 +200,7 @@ class XliffFileLoaderTest extends TestCase
|
|||||||
// message with empty target
|
// message with empty target
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
[
|
[
|
||||||
|
'source' => 'key',
|
||||||
'notes' => [
|
'notes' => [
|
||||||
['content' => 'baz'],
|
['content' => 'baz'],
|
||||||
['priority' => 2, 'from' => 'bar', 'content' => 'qux'],
|
['priority' => 2, 'from' => 'bar', 'content' => 'qux'],
|
||||||
@ -304,6 +308,7 @@ class XliffFileLoaderTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
[
|
[
|
||||||
|
'source' => 'foo',
|
||||||
'id' => '1',
|
'id' => '1',
|
||||||
'file' => [
|
'file' => [
|
||||||
'original' => 'file.ext',
|
'original' => 'file.ext',
|
||||||
@ -313,6 +318,7 @@ class XliffFileLoaderTest extends TestCase
|
|||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
[
|
[
|
||||||
|
'source' => 'test',
|
||||||
'notes' => [['content' => 'note']],
|
'notes' => [['content' => 'note']],
|
||||||
'id' => '4',
|
'id' => '4',
|
||||||
'file' => [
|
'file' => [
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
<target>bar</target>
|
<target>bar</target>
|
||||||
<note priority="1">foo</note>
|
<note priority="1">foo</note>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="2">
|
<trans-unit id="2" resname="extra">
|
||||||
<source>extra</source>
|
<source>extrasource</source>
|
||||||
<note from="foo">bar</note>
|
<note from="foo">bar</note>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="123">
|
<trans-unit id="123">
|
||||||
|
Reference in New Issue
Block a user