From 7f51bf1dbc02280ee9ac31b3385f1812e4012928 Mon Sep 17 00:00:00 2001 From: domenico Date: Thu, 18 Oct 2018 13:44:08 +0200 Subject: [PATCH] Fixed back conversion issues --- lib/Features/Microsoft.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Features/Microsoft.php b/lib/Features/Microsoft.php index 08e87db..299d6b1 100644 --- a/lib/Features/Microsoft.php +++ b/lib/Features/Microsoft.php @@ -323,9 +323,14 @@ public function overrideReviseJobQA( $jobQA, $id_job, $password_job, $job_words */ public function changeXliffTargetLangCode( $language, $filePath ){ - if( $this->needsConversion( $filePath ) ){ - if( \CatUtils::isCJK( $language ) ){ - $language = 'it-IT'; + $fileInfo = \DetectProprietaryXliff::isXliff( null, $filePath ); + if ( isset( $fileInfo[ 0 ] ) ) { + //this allow xlf converted with matecat filters to be back converted with the CJK language fix + preg_match( '#tool-id\s*=\s*"matecat-converter#i', $fileInfo[ 0 ], $matches ); + if ( !empty( $matches ) ) { + if( \CatUtils::isCJK( $language ) ){ + $language = 'it-IT'; + } } } @@ -352,10 +357,6 @@ public function forceXLIFFConversion( $forceXliff, $_userIsLogged, $xliffPath ) if( !$_userIsLogged ) { return $forceXliff; } - return $this->needsConversion( $xliffPath ); - } - - private function needsConversion( $xliffPath ){ $fileInfo = \DetectProprietaryXliff::isXliff( null, $xliffPath ); if ( isset( $fileInfo[ 0 ] ) ) { preg_match( '#tool-id\s*=\s*"mdxliff"#i', $fileInfo[ 0 ], $matches );