Skip to content

Commit

Permalink
Fixed issue with chinese conversion for new pilot
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostico committed Oct 17, 2018
1 parent c98382f commit f2ab582
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions lib/Features/Microsoft.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class Microsoft extends BaseFeature {

const FEATURE_CODE = "microsoft";

protected $logger_name = self::FEATURE_CODE;

public static $dependencies = [
Features::PROJECT_COMPLETION,
Features::TRANSLATION_VERSIONS,
Expand Down Expand Up @@ -313,15 +315,22 @@ public function overrideReviseJobQA( $jobQA, $id_job, $password_job, $job_words

/**
* Because of a bug in filters we force languages conversion to it-IT when isCJK
* @param array $array
*
* @return array
* @param string $language
* @param string $filePath
*
* @return string
*/
public function overrideConversionRequest( $language ){
if( \CatUtils::isCJK( $language ) ){
$language = 'it-IT';
public function changeXliffTargetLangCode( $language, $filePath ){

if( $this->needsConversion( $filePath ) ){
if( \CatUtils::isCJK( $language ) ){
$language = 'it-IT';
}
}

return $language;

}

public function overrideConversionResult( $documentContent, $language ){
Expand All @@ -343,6 +352,10 @@ 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 f2ab582

Please sign in to comment.