Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
riccio82 committed Oct 22, 2018
2 parents 78cd0c2 + 7f51bf1 commit d8686db
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/Features/Microsoft.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
}

Expand All @@ -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 );
Expand Down

0 comments on commit d8686db

Please sign in to comment.