Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Generators/Xliff.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public static function toString(Translations $translations, array $options = [])
$xliff = $dom->appendChild($dom->createElement('xliff'));
$xliff->setAttribute('xmlns', 'urn:oasis:names:tc:xliff:document:2.0');
$xliff->setAttribute('version', '2.0');
$xliff->setAttribute('srcLang', $translations->getLanguage());
$xliff->setAttribute('trgLang', $translations->getLanguage());
$xliff->setAttribute('srcLang', $translations->getHeader('X-Source-Language')?: $translations->getLanguage());
$xliff->setAttribute('trgLang', $translations->getHeader('X-Target-Language')?: $translations->getLanguage());
$file = $xliff->appendChild($dom->createElement('file'));
$file->setAttribute('id', $translations->getDomain().'.'.$translations->getLanguage());

Expand Down
2 changes: 2 additions & 0 deletions src/Translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class Translations extends ArrayObject
'MIME-Version' => '1.0',
'Content-Type' => 'text/plain; charset=UTF-8',
'Content-Transfer-Encoding' => '8bit',
'X-Target-Language' => '',
'X-Source-Language' => '',
],
'headersSorting' => false,
'defaultDateHeaders' => [
Expand Down
26 changes: 13 additions & 13 deletions tests/AssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function testPo()
$translations = static::get('po/input', 'Po');
$countTranslations = 3;
$countTranslated = 3;
$countHeaders = 9;
$countHeaders = 11;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -54,7 +54,7 @@ public function testPo2()
$translations = static::get('po2/input', 'Po');
$countTranslations = 13;
$countTranslated = 10;
$countHeaders = 13;
$countHeaders = 15;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -90,7 +90,7 @@ public function testPo3()
$translations = static::get('po3/input', 'Po');
$countTranslations = 8;
$countTranslated = 8;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -126,7 +126,7 @@ public function testBlade()
$translations = static::get('blade/input', 'Blade');
$countTranslations = 11;
$countTranslated = 0;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -162,7 +162,7 @@ public function testJed()
$translations = static::get('jed/input', 'Jed');
$countTranslations = 13;
$countTranslated = 10;
$countHeaders = 10;
$countHeaders = 12;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -198,7 +198,7 @@ public function testJsCode()
$translations = static::get('jscode/input', 'JsCode');
$countTranslations = 7;
$countTranslated = 0;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -234,7 +234,7 @@ public function testJs2Code()
$translations = static::get('jscode2/input', 'JsCode');
$countTranslations = 4;
$countTranslated = 0;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -269,7 +269,7 @@ public function testPhpCode()
$translations = static::get('phpcode/input', 'PhpCode');
$countTranslations = 12;
$countTranslated = 0;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -309,7 +309,7 @@ public function testPhpCode2()
]);
$countTranslations = 13;
$countTranslated = 0;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -347,7 +347,7 @@ public function testPhpCode3()
]);
$countTranslations = 2;
$countTranslated = 0;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -383,7 +383,7 @@ public function testTwig()
$translations = static::get('twig/input', 'Twig');
$countTranslations = 10;
$countTranslated = 0;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -423,7 +423,7 @@ public function testVueJs()
$translations = static::get('vuejs/input', 'VueJs');
$countTranslations = 31;
$countTranslated = 0;
$countHeaders = 8;
$countHeaders = 10;

$this->assertCount($countTranslations, $translations);
$this->assertCount($countHeaders, $translations->getHeaders());
Expand Down Expand Up @@ -466,7 +466,7 @@ public function testPhpCode4()
'domainOnly' => true,
]);

$countHeaders = 9;
$countHeaders = 11;
$countTranslated = 0;
$countTranslations = 4;

Expand Down