@@ -28,38 +28,38 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @inheritDoc |
| 30 | 30 | */ |
| 31 | - protected function tagOpen( $parser, string $name, array $attr ) { |
|
| 31 | + protected function tagOpen($parser, string $name, array $attr) { |
|
| 32 | 32 | |
| 33 | - $this->handleOpenUnit( $name, $attr ); |
|
| 33 | + $this->handleOpenUnit($name, $attr); |
|
| 34 | 34 | |
| 35 | 35 | // check if we are entering into a <target> |
| 36 | - $this->checkSetInTarget( $name ); |
|
| 36 | + $this->checkSetInTarget($name); |
|
| 37 | 37 | |
| 38 | 38 | // reset Marker positions |
| 39 | - if ( 'sdl:seg-defs' == $name ) { |
|
| 39 | + if ('sdl:seg-defs' == $name) { |
|
| 40 | 40 | $this->segmentInUnitPosition = 0; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // open buffer |
| 44 | - $this->setInBuffer( $name ); |
|
| 44 | + $this->setInBuffer($name); |
|
| 45 | 45 | |
| 46 | 46 | // check if we are inside a <target>, obviously this happen only if there are targets inside the trans-unit |
| 47 | 47 | // <target> must be stripped to be replaced, so this check avoids <target> reconstruction |
| 48 | - if ( !$this->inTarget ) { |
|
| 48 | + if (!$this->inTarget) { |
|
| 49 | 49 | |
| 50 | 50 | // costruct tag |
| 51 | 51 | $tag = "<$name "; |
| 52 | 52 | |
| 53 | - foreach ( $attr as $k => $v ) { |
|
| 53 | + foreach ($attr as $k => $v) { |
|
| 54 | 54 | |
| 55 | 55 | // if tag name is file, we must replace the target-language attribute |
| 56 | - if ( $name == 'file' && $k == 'target-language' && !empty( $this->targetLang ) ) { |
|
| 56 | + if ($name == 'file' && $k == 'target-language' && !empty($this->targetLang)) { |
|
| 57 | 57 | //replace Target language with job language provided from constructor |
| 58 | 58 | $tag .= "$k=\"$this->targetLang\" "; |
| 59 | 59 | } else { |
| 60 | 60 | //normal tag flux, put attributes in it |
| 61 | 61 | // Warning, this is NOT an elseif |
| 62 | - if ( $k != 'conf' ) { |
|
| 62 | + if ($k != 'conf') { |
|
| 63 | 63 | //put also the current attribute in it if it is not a "conf" attribute |
| 64 | 64 | $tag .= "$k=\"$v\" "; |
| 65 | 65 | } |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $seg = $this->getCurrentSegment(); |
| 70 | 70 | |
| 71 | - if ( 'sdl:seg' == $name && !empty( $seg ) && isset( $seg[ 'sid' ] ) ) { |
|
| 72 | - $tag .= $this->prepareTargetStatuses( $seg ); |
|
| 71 | + if ('sdl:seg' == $name && !empty($seg) && isset($seg['sid'])) { |
|
| 72 | + $tag .= $this->prepareTargetStatuses($seg); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $this->checkForSelfClosedTagAndFlush( $parser, $tag ); |
|
| 75 | + $this->checkForSelfClosedTagAndFlush($parser, $tag); |
|
| 76 | 76 | |
| 77 | 77 | } |
| 78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - protected function prepareTargetStatuses( $segment ): string { |
|
| 86 | + protected function prepareTargetStatuses($segment): string { |
|
| 87 | 87 | $statusMap = [ |
| 88 | 88 | 'NEW' => '', |
| 89 | 89 | 'DRAFT' => 'Draft', |
@@ -93,19 +93,19 @@ discard block |
||
| 93 | 93 | 'REJECTED' => 'RejectedTranslation', |
| 94 | 94 | ]; |
| 95 | 95 | |
| 96 | - return "conf=\"{$statusMap[ $segment[ 'status' ] ]}\" "; |
|
| 96 | + return "conf=\"{$statusMap[$segment['status']]}\" "; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - protected function rebuildMarks( array $seg, string $translation ): string { |
|
| 99 | + protected function rebuildMarks(array $seg, string $translation): string { |
|
| 100 | 100 | |
| 101 | - $trailingSpaces = str_repeat( ' ', Strings::getTheNumberOfTrailingSpaces( $translation ) ); |
|
| 101 | + $trailingSpaces = str_repeat(' ', Strings::getTheNumberOfTrailingSpaces($translation)); |
|
| 102 | 102 | |
| 103 | - if ( $seg[ 'mrk_id' ] !== null && $seg[ 'mrk_id' ] != '' ) { |
|
| 104 | - if ( $this->targetLang === 'ja-JP' ) { |
|
| 105 | - $seg[ 'mrk_succ_tags' ] = ltrim( $seg[ 'mrk_succ_tags' ] ); |
|
| 103 | + if ($seg['mrk_id'] !== null && $seg['mrk_id'] != '') { |
|
| 104 | + if ($this->targetLang === 'ja-JP') { |
|
| 105 | + $seg['mrk_succ_tags'] = ltrim($seg['mrk_succ_tags']); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $translation = "<mrk mid=\"" . $seg[ 'mrk_id' ] . "\" mtype=\"seg\">" . $seg[ 'mrk_prev_tags' ] . rtrim( $translation ) . $seg[ 'mrk_succ_tags' ] . "</mrk>" . $trailingSpaces; |
|
| 108 | + $translation = "<mrk mid=\"" . $seg['mrk_id'] . "\" mtype=\"seg\">" . $seg['mrk_prev_tags'] . rtrim($translation) . $seg['mrk_succ_tags'] . "</mrk>" . $trailingSpaces; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | return $translation; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return string |
| 122 | 122 | */ |
| 123 | - protected function createTargetTag( string $translation, string $stateProp ): string { |
|
| 123 | + protected function createTargetTag(string $translation, string $stateProp): string { |
|
| 124 | 124 | $targetLang = ' xml:lang="' . $this->targetLang . '"'; |
| 125 | 125 | |
| 126 | 126 | return "<target $targetLang $stateProp>$translation</target>"; |
@@ -36,34 +36,34 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * @var string |
| 38 | 38 | */ |
| 39 | - protected string $namespace = "mtc"; // Custom namespace |
|
| 39 | + protected string $namespace = "mtc"; // Custom namespace |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * @inheritDoc |
| 43 | 43 | */ |
| 44 | - protected function tagOpen( $parser, string $name, array $attr ) { |
|
| 44 | + protected function tagOpen($parser, string $name, array $attr) { |
|
| 45 | 45 | |
| 46 | - $this->handleOpenUnit( $name, $attr ); |
|
| 46 | + $this->handleOpenUnit($name, $attr); |
|
| 47 | 47 | |
| 48 | - $this->trySetAltTrans( $name );; |
|
| 49 | - $this->checkSetInTarget( $name ); |
|
| 48 | + $this->trySetAltTrans($name); ; |
|
| 49 | + $this->checkSetInTarget($name); |
|
| 50 | 50 | |
| 51 | 51 | // open buffer |
| 52 | - $this->setInBuffer( $name ); |
|
| 52 | + $this->setInBuffer($name); |
|
| 53 | 53 | |
| 54 | 54 | // check if we are inside a <target>, obviously this happen only if there are targets inside the trans-unit |
| 55 | 55 | // <target> must be stripped to be replaced, so this check avoids <target> reconstruction |
| 56 | - if ( !$this->inTarget ) { |
|
| 56 | + if (!$this->inTarget) { |
|
| 57 | 57 | |
| 58 | 58 | $tag = ''; |
| 59 | 59 | |
| 60 | 60 | // construct tag |
| 61 | 61 | $tag .= "<$name "; |
| 62 | 62 | |
| 63 | - foreach ( $attr as $k => $v ) { |
|
| 63 | + foreach ($attr as $k => $v) { |
|
| 64 | 64 | |
| 65 | 65 | //if tag name is file, we must replace the target-language attribute |
| 66 | - if ( $name === 'file' && $k === 'target-language' && !empty( $this->targetLang ) ) { |
|
| 66 | + if ($name === 'file' && $k === 'target-language' && !empty($this->targetLang)) { |
|
| 67 | 67 | //replace Target language with job language provided from constructor |
| 68 | 68 | $tag .= "$k=\"$this->targetLang\" "; |
| 69 | 69 | } else { |
@@ -74,20 +74,20 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $seg = $this->getCurrentSegment(); |
| 76 | 76 | |
| 77 | - if ( $name === $this->tuTagName && !empty( $seg ) && isset( $seg[ 'sid' ] ) ) { |
|
| 77 | + if ($name === $this->tuTagName && !empty($seg) && isset($seg['sid'])) { |
|
| 78 | 78 | |
| 79 | 79 | // add `help-id` to xliff v.1* |
| 80 | - if ( strpos( $tag, 'help-id' ) === false ) { |
|
| 81 | - if ( !empty( $seg[ 'sid' ] ) ) { |
|
| 82 | - $tag .= "help-id=\"{$seg[ 'sid' ]}\" "; |
|
| 80 | + if (strpos($tag, 'help-id') === false) { |
|
| 81 | + if (!empty($seg['sid'])) { |
|
| 82 | + $tag .= "help-id=\"{$seg['sid']}\" "; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $tag = $this->handleOpenXliffTag( $name, $attr, $tag ); |
|
| 88 | + $tag = $this->handleOpenXliffTag($name, $attr, $tag); |
|
| 89 | 89 | |
| 90 | - $this->checkForSelfClosedTagAndFlush( $parser, $tag ); |
|
| 90 | + $this->checkForSelfClosedTagAndFlush($parser, $tag); |
|
| 91 | 91 | |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | /** |
| 98 | 98 | * @inheritDoc |
| 99 | 99 | */ |
| 100 | - protected function tagClose( $parser, string $name ) { |
|
| 100 | + protected function tagClose($parser, string $name) { |
|
| 101 | 101 | $tag = ''; |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -106,15 +106,15 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * self::tagOpen method |
| 108 | 108 | */ |
| 109 | - if ( !$this->isEmpty ) { |
|
| 109 | + if (!$this->isEmpty) { |
|
| 110 | 110 | |
| 111 | - if ( !$this->inTarget ) { |
|
| 111 | + if (!$this->inTarget) { |
|
| 112 | 112 | $tag = "</$name>"; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if ( 'target' == $name && !$this->inAltTrans ) { |
|
| 115 | + if ('target' == $name && !$this->inAltTrans) { |
|
| 116 | 116 | |
| 117 | - if ( isset( $this->transUnits[ $this->currentTransUnitId ] ) ) { |
|
| 117 | + if (isset($this->transUnits[$this->currentTransUnitId])) { |
|
| 118 | 118 | |
| 119 | 119 | // get translation of current segment, by indirect indexing: id -> positional index -> segment |
| 120 | 120 | // actually there may be more than one segment to that ID if there are two mrk of the same source segment |
@@ -125,45 +125,45 @@ discard block |
||
| 125 | 125 | $this->targetWasWritten = true; |
| 126 | 126 | // signal we are leaving a target |
| 127 | 127 | $this->inTarget = false; |
| 128 | - $this->postProcAndFlush( $this->outputFP, $tag, true ); |
|
| 128 | + $this->postProcAndFlush($this->outputFP, $tag, true); |
|
| 129 | 129 | |
| 130 | - } elseif ( in_array( $name, $this->nodesToBuffer ) ) { // we are closing a critical CDATA section |
|
| 130 | + } elseif (in_array($name, $this->nodesToBuffer)) { // we are closing a critical CDATA section |
|
| 131 | 131 | |
| 132 | 132 | $this->bufferIsActive = false; |
| 133 | 133 | $tag = $this->CDATABuffer . "</$name>"; |
| 134 | 134 | $this->CDATABuffer = ""; |
| 135 | 135 | |
| 136 | 136 | //flush to the pointer |
| 137 | - $this->postProcAndFlush( $this->outputFP, $tag ); |
|
| 137 | + $this->postProcAndFlush($this->outputFP, $tag); |
|
| 138 | 138 | |
| 139 | - } elseif ( $name === $this->tuTagName ) { |
|
| 139 | + } elseif ($name === $this->tuTagName) { |
|
| 140 | 140 | |
| 141 | 141 | $tag = ""; |
| 142 | 142 | |
| 143 | 143 | // handling </trans-unit> closure |
| 144 | - if ( !$this->targetWasWritten ) { |
|
| 144 | + if (!$this->targetWasWritten) { |
|
| 145 | 145 | |
| 146 | - if ( isset( $this->transUnits[ $this->currentTransUnitId ] ) ) { |
|
| 146 | + if (isset($this->transUnits[$this->currentTransUnitId])) { |
|
| 147 | 147 | $tag = $this->rebuildTarget(); |
| 148 | 148 | } else { |
| 149 | - $tag = $this->createTargetTag( "", "" ); |
|
| 149 | + $tag = $this->createTargetTag("", ""); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $tag .= "</$this->tuTagName>"; |
|
| 154 | + $tag .= "</$this->tuTagName>"; |
|
| 155 | 155 | $this->targetWasWritten = false; |
| 156 | - $this->postProcAndFlush( $this->outputFP, $tag ); |
|
| 156 | + $this->postProcAndFlush($this->outputFP, $tag); |
|
| 157 | 157 | |
| 158 | - } elseif ( $this->bufferIsActive ) { // this is a tag ( <g | <mrk ) inside a seg or seg-source tag |
|
| 158 | + } elseif ($this->bufferIsActive) { // this is a tag ( <g | <mrk ) inside a seg or seg-source tag |
|
| 159 | 159 | $this->CDATABuffer .= "</$name>"; |
| 160 | 160 | // Do NOT Flush |
| 161 | 161 | } else { //generic tag closure do Nothing |
| 162 | 162 | // flush to pointer |
| 163 | - $this->postProcAndFlush( $this->outputFP, $tag ); |
|
| 163 | + $this->postProcAndFlush($this->outputFP, $tag); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - } elseif ( in_array( $name, $this->nodesToBuffer ) ) { |
|
| 166 | + } elseif (in_array($name, $this->nodesToBuffer)) { |
|
| 167 | 167 | |
| 168 | 168 | $this->isEmpty = false; |
| 169 | 169 | $this->bufferIsActive = false; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $this->CDATABuffer = ""; |
| 172 | 172 | |
| 173 | 173 | //flush to the pointer |
| 174 | - $this->postProcAndFlush( $this->outputFP, $tag ); |
|
| 174 | + $this->postProcAndFlush($this->outputFP, $tag); |
|
| 175 | 175 | |
| 176 | 176 | } else { |
| 177 | 177 | //ok, nothing to be done; reset flag for next coming tag |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // try to signal that we are leaving a target |
| 182 | - $this->tryUnsetAltTrans( $name ); |
|
| 182 | + $this->tryUnsetAltTrans($name); |
|
| 183 | 183 | |
| 184 | 184 | // check if we are leaving a <trans-unit> (xliff v1.*) or <unit> (xliff v2.*) |
| 185 | - if ( $this->tuTagName === $name ) { |
|
| 185 | + if ($this->tuTagName === $name) { |
|
| 186 | 186 | $this->currentTransUnitIsTranslatable = null; |
| 187 | 187 | $this->inTU = false; |
| 188 | 188 | $this->hasWrittenCounts = false; |
@@ -199,31 +199,31 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return string |
| 201 | 201 | */ |
| 202 | - protected function prepareTranslation( array $seg, string $transUnitTranslation = "" ): string { |
|
| 202 | + protected function prepareTranslation(array $seg, string $transUnitTranslation = ""): string { |
|
| 203 | 203 | |
| 204 | - $segment = Strings::removeDangerousChars( $seg [ 'segment' ] ); |
|
| 205 | - $translation = Strings::removeDangerousChars( $seg [ 'translation' ] ); |
|
| 204 | + $segment = Strings::removeDangerousChars($seg ['segment']); |
|
| 205 | + $translation = Strings::removeDangerousChars($seg ['translation']); |
|
| 206 | 206 | |
| 207 | - if ( $seg [ 'translation' ] == '' ) { |
|
| 207 | + if ($seg ['translation'] == '') { |
|
| 208 | 208 | $translation = $segment; |
| 209 | 209 | } else { |
| 210 | - if ( $this->callback instanceof XliffReplacerCallbackInterface ) { |
|
| 211 | - $error = ( !empty( $seg[ 'error' ] ) ) ? $seg[ 'error' ] : null; |
|
| 212 | - if ( $this->callback->thereAreErrors( $seg[ 'sid' ], $segment, $translation, [], $error ) ) { |
|
| 210 | + if ($this->callback instanceof XliffReplacerCallbackInterface) { |
|
| 211 | + $error = (!empty($seg['error'])) ? $seg['error'] : null; |
|
| 212 | + if ($this->callback->thereAreErrors($seg['sid'], $segment, $translation, [], $error)) { |
|
| 213 | 213 | $translation = '|||UNTRANSLATED_CONTENT_START|||' . $segment . '|||UNTRANSLATED_CONTENT_END|||'; |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $transUnitTranslation .= $seg[ 'prev_tags' ] . $this->rebuildMarks( $seg, $translation ) . ltrim( $seg[ 'succ_tags' ] ); |
|
| 218 | + $transUnitTranslation .= $seg['prev_tags'] . $this->rebuildMarks($seg, $translation) . ltrim($seg['succ_tags']); |
|
| 219 | 219 | |
| 220 | 220 | return $transUnitTranslation; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - protected function rebuildMarks( array $seg, string $translation ): string { |
|
| 223 | + protected function rebuildMarks(array $seg, string $translation): string { |
|
| 224 | 224 | |
| 225 | - if ( $seg[ 'mrk_id' ] !== null && $seg[ 'mrk_id' ] != '' ) { |
|
| 226 | - $translation = "<mrk mid=\"" . $seg[ 'mrk_id' ] . "\" mtype=\"seg\">" . $seg[ 'mrk_prev_tags' ] . $translation . $seg[ 'mrk_succ_tags' ] . "</mrk>"; |
|
| 225 | + if ($seg['mrk_id'] !== null && $seg['mrk_id'] != '') { |
|
| 226 | + $translation = "<mrk mid=\"" . $seg['mrk_id'] . "\" mtype=\"seg\">" . $seg['mrk_prev_tags'] . $translation . $seg['mrk_succ_tags'] . "</mrk>"; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | return $translation; |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @return string |
| 240 | 240 | */ |
| 241 | - protected function createTargetTag( string $translation, string $stateProp ): string { |
|
| 241 | + protected function createTargetTag(string $translation, string $stateProp): string { |
|
| 242 | 242 | $targetLang = ' xml:lang="' . $this->targetLang . '"'; |
| 243 | 243 | $tag = "<target $targetLang $stateProp>$translation</target>"; |
| 244 | - $tag .= "\n<count-group name=\"$this->currentTransUnitId\"><count count-type=\"x-matecat-raw\">" . $this->counts[ 'raw_word_count' ] . "</count><count count-type=\"x-matecat-weighted\">" . $this->counts[ 'eq_word_count' ] . '</count></count-group>'; |
|
| 244 | + $tag .= "\n<count-group name=\"$this->currentTransUnitId\"><count count-type=\"x-matecat-raw\">" . $this->counts['raw_word_count'] . "</count><count count-type=\"x-matecat-weighted\">" . $this->counts['eq_word_count'] . '</count></count-group>'; |
|
| 245 | 245 | |
| 246 | 246 | return $tag; |
| 247 | 247 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | // we must reset the lastMrkId found because this is a new segment. |
| 258 | 258 | $lastMrkId = -1; |
| 259 | 259 | |
| 260 | - foreach ( $this->lastTransUnit as $pos => $seg ) { |
|
| 260 | + foreach ($this->lastTransUnit as $pos => $seg) { |
|
| 261 | 261 | |
| 262 | 262 | /* |
| 263 | 263 | * This routine works to respect the positional orders of markers. |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | * pre-assign zero to the new mrk if this is the first one ( in this segment ) |
| 271 | 271 | * If it is null leave it NULL |
| 272 | 272 | */ |
| 273 | - if ( (int)$seg[ "mrk_id" ] < 0 && $seg[ "mrk_id" ] !== null ) { |
|
| 274 | - $seg[ "mrk_id" ] = 0; |
|
| 273 | + if ((int)$seg["mrk_id"] < 0 && $seg["mrk_id"] !== null) { |
|
| 274 | + $seg["mrk_id"] = 0; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /* |
@@ -280,39 +280,39 @@ discard block |
||
| 280 | 280 | * ( null <= -1 ) === true |
| 281 | 281 | * so, cast to int |
| 282 | 282 | */ |
| 283 | - if ( (int)$seg[ "mrk_id" ] <= $lastMrkId ) { |
|
| 283 | + if ((int)$seg["mrk_id"] <= $lastMrkId) { |
|
| 284 | 284 | break; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // update counts |
| 288 | - if ( !empty( $seg ) ) { |
|
| 289 | - $this->updateSegmentCounts( $seg ); |
|
| 288 | + if (!empty($seg)) { |
|
| 289 | + $this->updateSegmentCounts($seg); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | // delete translations so the prepareSegment |
| 293 | 293 | // will put source content in target tag |
| 294 | - if ( $this->sourceInTarget ) { |
|
| 295 | - $seg[ 'translation' ] = ''; |
|
| 294 | + if ($this->sourceInTarget) { |
|
| 295 | + $seg['translation'] = ''; |
|
| 296 | 296 | $this->resetCounts(); |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // append $translation |
| 300 | - $translation = $this->prepareTranslation( $seg, $translation ); |
|
| 300 | + $translation = $this->prepareTranslation($seg, $translation); |
|
| 301 | 301 | |
| 302 | - $lastMrkId = $seg[ "mrk_id" ]; |
|
| 302 | + $lastMrkId = $seg["mrk_id"]; |
|
| 303 | 303 | |
| 304 | - [ $stateProp, $lastMrkState ] = StatusToStateAttribute::getState( $this->xliffVersion, $seg[ 'status' ], $lastMrkState ); |
|
| 304 | + [$stateProp, $lastMrkState] = StatusToStateAttribute::getState($this->xliffVersion, $seg['status'], $lastMrkState); |
|
| 305 | 305 | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | //append translation |
| 309 | - return $this->createTargetTag( $translation, $stateProp ); |
|
| 309 | + return $this->createTargetTag($translation, $stateProp); |
|
| 310 | 310 | |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | protected function getCurrentSegment(): array { |
| 314 | - if ( $this->currentTransUnitIsTranslatable !== 'no' && isset( $this->transUnits[ $this->currentTransUnitId ] ) ) { |
|
| 315 | - return $this->segments[ $this->transUnits[ $this->currentTransUnitId ][ 0 ] ]; // TODO try to understand why here is needed to override the method and set 0 index hardcoded |
|
| 314 | + if ($this->currentTransUnitIsTranslatable !== 'no' && isset($this->transUnits[$this->currentTransUnitId])) { |
|
| 315 | + return $this->segments[$this->transUnits[$this->currentTransUnitId][0]]; // TODO try to understand why here is needed to override the method and set 0 index hardcoded |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | return []; |