diff --git a/src/XliffParser/XliffParserV1.php b/src/XliffParser/XliffParserV1.php
index 3cb9a32..c6fc79e 100644
--- a/src/XliffParser/XliffParserV1.php
+++ b/src/XliffParser/XliffParserV1.php
@@ -173,6 +173,7 @@ protected function extractTransUnit( $transUnit, &$transUnitIdArrayForUniqueness
$segSource = @$output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'seg-source' ];
if ( isset( $targetRawContent ) && !empty( $targetRawContent ) && isset( $segSource ) && count( $segSource ) > 0 ) {
$output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'seg-target' ] = $this->extractContentWithMarksAndExtTags( $dom, $childNode, $targetRawContent );
+ $output[ 'files' ][ $i ][ 'trans-units' ][ $j ][ 'seg-target' ][ 0 ]['attr'] = $this->extractTagAttributes($childNode);
}
}
diff --git a/src/XliffReplacer/XliffSAXTranslationReplacer.php b/src/XliffReplacer/XliffSAXTranslationReplacer.php
index 18609c8..ef19a57 100644
--- a/src/XliffReplacer/XliffSAXTranslationReplacer.php
+++ b/src/XliffReplacer/XliffSAXTranslationReplacer.php
@@ -187,11 +187,11 @@ protected function tagOpen( $parser, $name, $attr ) {
$tag .= "$k=\"$this->targetLang\" ";
} else {
$pos = 0;
- if ( $this->currentTransUnitId ) {
+ if ( $this->currentTransUnitId and isset($this->transUnits[ $this->currentTransUnitId ])) {
$pos = current( $this->transUnits[ $this->currentTransUnitId ] );
}
- if ( $name === $this->tuTagName ) {
+ if ( $name === $this->tuTagName and isset($this->segments[ $pos ]) and isset($this->segments[ $pos ][ 'sid' ]) ) {
$sid = $this->segments[ $pos ][ 'sid' ];
@@ -209,6 +209,8 @@ protected function tagOpen( $parser, $name, $attr ) {
} elseif ( 'segment' === $name && $this->xliffVersion === 2 ) { // add state to segment in Xliff v2
list( $stateProp, $lastMrkState ) = $this->setTransUnitState( $this->segments[ $pos ], $stateProp, $lastMrkState );
+ } elseif ( 'target' === $name && $this->xliffVersion === 1 ) { // add state to target in Xliff v1
+ list( $stateProp, $lastMrkState ) = $this->setTransUnitState( $this->segments[ $pos ], $stateProp, $lastMrkState );
}
//normal tag flux, put attributes in it
@@ -629,8 +631,9 @@ protected function prepareTranslation( $seg, $transUnitTranslation = "" ) {
if ( is_null( $seg [ 'translation' ] ) || $seg [ 'translation' ] == '' ) {
$translation = $segment;
} else {
- if ( $this->callback ) {
- if ( $this->callback->thereAreErrors( $seg[ 'sid' ], $segment, $translation, $dataRefMap ) ) {
+ if ( $this->callback instanceof XliffReplacerCallbackInterface ) {
+ $error = (isset($seg['error'])) ? $seg['error'] : null;
+ if ( $this->callback->thereAreErrors( $seg[ 'sid' ], $segment, $translation, $dataRefMap, $error ) ) {
$translation = '|||UNTRANSLATED_CONTENT_START|||' . $segment . '|||UNTRANSLATED_CONTENT_END|||';
}
}
@@ -760,7 +763,13 @@ private function setTransUnitState( $seg, $state_prop, $lastMrkState ) {
case TranslationStatus::STATUS_FIXED:
case TranslationStatus::STATUS_APPROVED:
if ( $lastMrkState == null || $lastMrkState == TranslationStatus::STATUS_APPROVED ) {
- $state_prop = ( $this->xliffVersion === 2 ) ? "state=\"reviewed\"" : "state=\"signed-off\"";
+
+ if( isset($seg[ 'r2' ]) and $seg[ 'r2' ] == 1 ){
+ $state_prop = "state=\"final\"";
+ } else {
+ $state_prop = ( $this->xliffVersion === 2 ) ? "state=\"reviewed\"" : "state=\"signed-off\"";
+ }
+
$lastMrkState = TranslationStatus::STATUS_APPROVED;
}
break;
@@ -781,16 +790,19 @@ private function setTransUnitState( $seg, $state_prop, $lastMrkState ) {
break;
case TranslationStatus::STATUS_NEW:
- if ( ( $lastMrkState == null ) || $lastMrkState != TranslationStatus::STATUS_DRAFT ) {
+ if ( ( $lastMrkState == null ) || $lastMrkState != TranslationStatus::STATUS_NEW ) {
$state_prop = ( $this->xliffVersion === 2 ) ? "state=\"initial\"" : "state=\"new\"";
$lastMrkState = TranslationStatus::STATUS_NEW;
}
break;
case TranslationStatus::STATUS_DRAFT:
- $state_prop = "state=\"needs-translation\"";
- $lastMrkState = TranslationStatus::STATUS_DRAFT;
+ if ( ( $lastMrkState == null ) || $lastMrkState != TranslationStatus::STATUS_DRAFT ) {
+ $state_prop = ( $this->xliffVersion === 2 ) ? "state=\"initial\"" : "state=\"new\"";
+ $lastMrkState = TranslationStatus::STATUS_DRAFT;
+ }
break;
+
default:
// this is the case when a segment is not showed in cattool, so the row in
// segment_translations does not exists and
diff --git a/tests/XliffParserV1Test.php b/tests/XliffParserV1Test.php
index 978b113..64faca2 100644
--- a/tests/XliffParserV1Test.php
+++ b/tests/XliffParserV1Test.php
@@ -192,15 +192,24 @@ public function can_parse_xliff_v1_tu_with_extenal_tags_in_seg_source_and_target
$segSource = $parsed[ 'files' ][ 3 ]['trans-units'][ 1 ][ 'seg-source' ][ 0 ];
$segTarget = $parsed[ 'files' ][ 3 ]['trans-units'][ 1 ][ 'seg-target' ][ 0 ];
- $expected = [
+ $expected1 = [
'mid' => 0,
'ext-prec-tags' => '',
'raw-content' => 'An English string with g tags',
'ext-succ-tags' => '',
];
+ $expected2 = [
+ 'mid' => 0,
+ 'ext-prec-tags' => '',
+ 'raw-content' => 'An English string with g tags',
+ 'ext-succ-tags' => '',
+ 'attr' => [
+ 'xml:lang' => 'fr-fr'
+ ]
+ ];
- $this->assertEquals($expected, $segSource);
- $this->assertEquals($expected, $segTarget);
+ $this->assertEquals($expected1, $segSource);
+ $this->assertEquals($expected2, $segTarget);
}
/**
@@ -604,4 +613,29 @@ public function can_extract_custom_file_attributes()
$this->assertEquals($parsed['files'][3]['trans-units'][1]['notes'][1]['raw-content'], 'page1.txt');
$this->assertEquals($parsed['files'][3]['trans-units'][1]['notes'][2]['raw-content'], 'questa è una nota1');
}
+
+ /**
+ * @test
+ */
+ public function can_parse_segment_state_attribute()
+ {
+ $states = [
+ 'new',
+ 'needs-translation',
+ 'needs-adaptation',
+ 'needs-l10n',
+ 'needs-review-translation',
+ 'needs-review-adaptation',
+ 'needs-review-l10n',
+ 'translated',
+ 'signed-off',
+ 'final',
+ ];
+
+ $parsed = (new XliffParser())->xliffToArray($this->getTestFile('xliff12-with-segment-state.xliff'));
+
+ for($i = 1; $i <= count($parsed['files'][1]['trans-units']); $i++){
+ $this->assertEquals($parsed['files'][1]['trans-units'][$i]['seg-target'][0]['attr']['state'], $states[$i-1]);
+ }
+ }
}
diff --git a/tests/files/output/piazza.sdlxliff b/tests/files/output/piazza.sdlxliff
new file mode 100644
index 0000000..2f775a6
--- /dev/null
+++ b/tests/files/output/piazza.sdlxliff
@@ -0,0 +1,175 @@
+UEsDBBQAAAgIAAdQ6FKLgxhkCyYAAKEwAAARAAAAcWd6aHppcWEubHoxLmRvY3jtegVXHUuz9sY9
+ uFvQwMadBHd3d3d3h+DuGiC4W3AL7u7uBHd3ycd57ZyTm/v9gfs+s2bWdNc8NbN6VVdV95SsBBg4
+ GgASAA0AAIgA63lTluogAMB7CAAAFQANqiFgY+1oZO2oo+hma+SgRetqZfk+BxyUIgsACvgv/k+j
+ NmHYuoseSegu8RExtkFJfz+nBAgazp1EI38AheUBqvwS19/y2oYKKqcEEgtrSUzGdLfGpNznP7mU
+ agmDXOdCdoTJleQbr23GRrU4v03jY4hNvplAv8Y3yPrZkrmlFVuSFYSepK47blQBViY9N90fXfUe
+ EAVMjFYmdY9kIgh4xmDauGtdA0teI7OllKmDwn2nnYUCF189z+JlLUqMZbjoMK1qkigZoFuLFnro
+ eTCTmeCZLBtjv+zvgH8ehYPFkyKrEgV17EjoyCxHNdBHXOCiVxz+zVNR062pMo9aehlv41opn6z2
+ cYlGkA4kdmwlNadcNXs14ycFVEEkSAun0NYyPiJl7AYOgGNPOgBdkueb8MVwC2pezkpoCk4jp7DF
+ KkysKVi22+347sJSeljemN01iFnuFk/f2jfL8jGzDQDDwbSPVpronMk41I1VFi/+wO7yk9U9GADw
+ 8ycY4O9TkiAWp+Hs7U76bcbBvU1JHXsjSwc62j+u/52K/8UfKIvrNO+mh+c983/xn2yVW+rEypWm
+ M5hYxlqEgtYQk0RdXjCff33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AAAA==
+24d71a01-cb76-4737-b3d1-a244027590ed07/08/2021 12:06:04C:\Users\lorenza\Downloads\Sto attraversando la piazza silenziosa.docxqBold;qItalic;qUnderline;qSubscript;qSuperscript;qSmallCaps;qNonBreakingHyphen;qOptionalHyphen;qNoBold;qNoItalic;qNoUnderline;qNoSubscript;qNoSuperscript;qStrikeThrough;qNoStrikeThrough;qNoSmallCapsFalse50WordprocessingML v. 211TrueCambria1223043667word\document.xml<cf italic=True>w:rPrw:rTruew:r<w:i/>w:rTruew:rw:r<w:lang w:eastAsia="it-IT"/>w:r</cf><cf font=Cambria size=12>w:rPrw:rTrue<w:rFonts w:ascii="Cambria" w:hAnsi="Cambria"/>w:rCambria<w:sz w:val="24"/>w:r12<w:szCs w:val="24"/>w:r<w:lang w:eastAsia="it-IT"/>w:r</cf>“Sto attraversando la piazza silenziosa. Il lago giace calmo e sereno. Le bianche case pallidamente risplendono sulla collina. Gatti piccoli e grossi attraversano il mio cammino.” Marianne Werefkin “Bla bla bla. Bla bla bla. Bla bla bla. Altra traduzione Marianne Werefkin dYpIABK5p8ujbecMJGKGhe67j5s=kZxyM+TZheoF+/V6VW3/mrulQ5o=YJSYid4jBIdypMEeu+Z5jGvuy/0=cBEy5pqZOoweX+ruNCjDcMR7crs=q3puk8N76ctfA4zGmwObQP7/O+E=
\ No newline at end of file
diff --git a/tests/files/xliff12-with-segment-state.xliff b/tests/files/xliff12-with-segment-state.xliff
new file mode 100644
index 0000000..cb49532
--- /dev/null
+++ b/tests/files/xliff12-with-segment-state.xliff
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+ Upload an image
+
+
+ Upload an image
+
+
+
+
+
+
+ Enter image link
+
+
+ Enter image link
+
+
+
+
+
+
+ Please upload an image
+
+
+ Please upload an image
+
+
+
+
+
+
+ Your image file
+
+
+ Your image file
+
+
+
+
+
+
+ Image URL
+
+
+ Image URL
+
+
+
+
+
+
+ Enter an image URL
+
+
+ Enter an image URL
+
+
+
+
+
+
+ Supports GIF, JPG, and PNG files.
+
+
+ Supports GIF, JPG, and PNG files.
+
+
+
+
+
+
+ Use this file
+
+
+ Use this file
+
+
+
+
+
+
+ Do not close the page until this upload is complete.
+
+
+ Do not close the page until this upload is complete.
+
+
+
+
+
+
+ Upload a video
+
+
+ Upload a video
+
+
+
+
+
+
+
\ No newline at end of file