From 42ddfae136728b231bb2fe635de0d3cff023a9d2 Mon Sep 17 00:00:00 2001 From: riccio82 Date: Thu, 24 May 2018 10:41:07 +0200 Subject: [PATCH 01/13] Hide outsource --- .../Microsoft/Decorator/AnalyzeDecorator.php | 19 +++++++++++++++++++ .../Microsoft/Decorator/ManageDecorator.php | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 lib/Features/Microsoft/Decorator/AnalyzeDecorator.php diff --git a/lib/Features/Microsoft/Decorator/AnalyzeDecorator.php b/lib/Features/Microsoft/Decorator/AnalyzeDecorator.php new file mode 100644 index 0000000..35f1a70 --- /dev/null +++ b/lib/Features/Microsoft/Decorator/AnalyzeDecorator.php @@ -0,0 +1,19 @@ +template->enable_outsource = false; + } + + +} \ No newline at end of file diff --git a/lib/Features/Microsoft/Decorator/ManageDecorator.php b/lib/Features/Microsoft/Decorator/ManageDecorator.php index 8e09135..62af192 100644 --- a/lib/Features/Microsoft/Decorator/ManageDecorator.php +++ b/lib/Features/Microsoft/Decorator/ManageDecorator.php @@ -13,6 +13,8 @@ class ManageDecorator extends AbstractDecorator { public function decorate() { $this->template->append( 'css_resources', Routes::staticBuild( '/microsoft-build.css' ) ); + + $this->template->enable_outsource = false; } From 835a0682c03d652f3fbeffc36b7e1ffd024749a1 Mon Sep 17 00:00:00 2001 From: Ostico Domenico Lupinetti Date: Thu, 24 May 2018 19:41:52 +0200 Subject: [PATCH 02/13] Adjusted revision scores --- lib/Features/Microsoft/Utils/Constants/Revise.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Features/Microsoft/Utils/Constants/Revise.php b/lib/Features/Microsoft/Utils/Constants/Revise.php index 74e80bd..be2df60 100644 --- a/lib/Features/Microsoft/Utils/Constants/Revise.php +++ b/lib/Features/Microsoft/Utils/Constants/Revise.php @@ -14,11 +14,10 @@ class Revise extends \Constants_Revise{ * Max allowed errors for category */ const WORD_INTERVAL = 1000; - const MAX_TYPING = 1; - const MAX_TRANSLATION = 1; + const MAX_TYPING = 2; + const MAX_TRANSLATION = 2; const MAX_TERMINOLOGY = 1; - const MAX_QUALITY = 1; - const MAX_STYLE = 5; - - + const MAX_QUALITY = 3; + const MAX_STYLE = 7; + } \ No newline at end of file From b75a1023fc335c8c0d802f4150968e3362bedbd2 Mon Sep 17 00:00:00 2001 From: Ostico Domenico Lupinetti Date: Thu, 24 May 2018 19:46:05 +0200 Subject: [PATCH 03/13] Fixed review score parameters --- lib/Features/Microsoft/Utils/Constants/Revise.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Features/Microsoft/Utils/Constants/Revise.php b/lib/Features/Microsoft/Utils/Constants/Revise.php index be2df60..9272af0 100644 --- a/lib/Features/Microsoft/Utils/Constants/Revise.php +++ b/lib/Features/Microsoft/Utils/Constants/Revise.php @@ -19,5 +19,5 @@ class Revise extends \Constants_Revise{ const MAX_TERMINOLOGY = 1; const MAX_QUALITY = 3; const MAX_STYLE = 7; - + } \ No newline at end of file From fe93b5c10032ab70d597cff00b4da1318e077009 Mon Sep 17 00:00:00 2001 From: riccio82 Date: Fri, 25 May 2018 15:27:14 +0200 Subject: [PATCH 04/13] Hide revise link in translate page --- static/src/css/sass/microsoft-core.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/src/css/sass/microsoft-core.scss b/static/src/css/sass/microsoft-core.scss index 5e8af56..0e59069 100644 --- a/static/src/css/sass/microsoft-core.scss +++ b/static/src/css/sass/microsoft-core.scss @@ -26,6 +26,14 @@ body.review { display: none; } } + +body.translate { + footer { + .wrapper nav ul li:nth-child(2) { + display: none; + } + } +} body .tab-switcher-notes { display: none; } From d6805c4743fa2d1dbc9f364aec3bfc2a6fe3ed5c Mon Sep 17 00:00:00 2001 From: domenico Date: Fri, 25 May 2018 17:42:44 +0200 Subject: [PATCH 05/13] Force languages conversion to it-IT when isCJK --- lib/Features/Microsoft.php | 13 +++++++++++++ .../TranslatedConnectorController.php | 17 ++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/Features/Microsoft.php b/lib/Features/Microsoft.php index 69c9fed..54447c5 100644 --- a/lib/Features/Microsoft.php +++ b/lib/Features/Microsoft.php @@ -148,4 +148,17 @@ 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 + */ + public function overrideConversionRequest( Array $array ){ + if( \CatUtils::isCJK( $array[ 'target' ] ) ){ + $array[ 'target' ] = 'it-IT'; + } + return $array; + } + } \ No newline at end of file diff --git a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php index b993855..bf2e128 100644 --- a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php +++ b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php @@ -11,9 +11,9 @@ use API\V2\KleinController; use API\V2\Validators\JobPasswordValidator; use API\V2\Json\ProjectUrls; +use DataAccess\ShapelessConcreteStruct; use Features\Microsoft\Utils\Email\ConfirmedQuotationEmail; use Features\Microsoft\Utils\Email\ErrorQuotationEmail; -use Features\Microsoft\View\API\JSON\MicrosoftUrlsDecorator; use Features\Microsoft; use \Features\Outsource\Traits\Translated as TranslatedTrait; @@ -21,6 +21,9 @@ class TranslatedConnectorController extends KleinController { use TranslatedTrait; + protected $job; + protected $project; + protected function afterConstruct() { $jobValidator = ( new JobPasswordValidator( $this ) ); @@ -45,15 +48,15 @@ public function sendJob() { $this->config = Microsoft::getConfig(); - $eq_word = \Jobs_JobDao::getEQWord($this->job); + $eq_word = \Jobs_JobDao::getEQWord( $this->job ); $this->setSuccessMailSender( new ConfirmedQuotationEmail( Microsoft::getPluginBasePath() . '/Features/Microsoft/View/Emails/confirmed_quotation.html' ) ); $this->setFailureMailSender( new ErrorQuotationEmail( Microsoft::getPluginBasePath() . '/Features/Microsoft/View/Emails/error_quotation.html' ) ); - $response = $this->requestJobQuote($this->job, $eq_word, $this->project, $formatted); - if(!empty($response)){ - $this->response->body( "ok - ".$this->getExternalProjectId() ); - }else{ - $this->response->body( "ko" ); + $response = $this->requestJobQuote( $this->job, $eq_word, $this->project, $formatted ); + if ( !empty( $response ) ) { + $this->response->body( "ok - " . $this->getExternalProjectId() ); + } else { + $this->response->body( "ko" ); } } From b0899fc3809d8dce874145adb36d9666392233b1 Mon Sep 17 00:00:00 2001 From: domenico Date: Fri, 25 May 2018 18:46:37 +0200 Subject: [PATCH 06/13] Fix bad Xliff languages for CJK ( rewrite xliff ) --- lib/Features/Microsoft.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/Features/Microsoft.php b/lib/Features/Microsoft.php index 54447c5..02f823a 100644 --- a/lib/Features/Microsoft.php +++ b/lib/Features/Microsoft.php @@ -155,10 +155,36 @@ public function overrideReviseJobQA( $jobQA, $id_job, $password_job, $job_words * @return array */ public function overrideConversionRequest( Array $array ){ + if( \CatUtils::isCJK( $array[ 'target' ] ) ){ + $array[ 'target' ] = 'it-IT'; + + $array[ 'path' ]; + + if ( is_file( $array[ 'path' ] ) === true ) { + + $file = fopen( $array[ 'path' ], 'r' ); + $temp = tempnam( '/tmp', 'mic_' ); + + if ( is_resource( $file ) === true ) { + + while ( feof( $file ) === false ) { + file_put_contents( $temp, str_replace( $array[ 'target' ], 'it-IT', fgets( $file ) ), FILE_APPEND ); + } + + fclose( $file ); + } + + unlink( $array[ 'path' ] ); + rename( $temp, $array[ 'path' ] ); + + } + } + return $array; + } } \ No newline at end of file From beb00989953e552ac18201ddb293de9607c559ea Mon Sep 17 00:00:00 2001 From: domenico Date: Fri, 25 May 2018 19:53:53 +0200 Subject: [PATCH 07/13] Brutal override of source language for CJK languages - Workaround for filters issue when handling whitespaces --- lib/Features/Microsoft.php | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/lib/Features/Microsoft.php b/lib/Features/Microsoft.php index 02f823a..31da467 100644 --- a/lib/Features/Microsoft.php +++ b/lib/Features/Microsoft.php @@ -154,37 +154,16 @@ public function overrideReviseJobQA( $jobQA, $id_job, $password_job, $job_words * * @return array */ - public function overrideConversionRequest( Array $array ){ - - if( \CatUtils::isCJK( $array[ 'target' ] ) ){ - - $array[ 'target' ] = 'it-IT'; - - $array[ 'path' ]; - - if ( is_file( $array[ 'path' ] ) === true ) { - - $file = fopen( $array[ 'path' ], 'r' ); - $temp = tempnam( '/tmp', 'mic_' ); - - if ( is_resource( $file ) === true ) { - - while ( feof( $file ) === false ) { - file_put_contents( $temp, str_replace( $array[ 'target' ], 'it-IT', fgets( $file ) ), FILE_APPEND ); - } - - fclose( $file ); - } - - unlink( $array[ 'path' ] ); - rename( $temp, $array[ 'path' ] ); - - } - + public function overrideConversionRequest( $language ){ + if( \CatUtils::isCJK( $language ) ){ + $language = 'it-IT'; } + return $language; + } - return $array; - + public function overrideConversionResult( $documentContent, $language ){ + return preg_replace( '/target-language=".*?"/', "target-language=\"{$language}\"", $documentContent ); } + } \ No newline at end of file From fdd136bb69272e535ec64f38bfe0d15acac86fdc Mon Sep 17 00:00:00 2001 From: Ostico Domenico Lupinetti Date: Fri, 25 May 2018 22:40:16 +0200 Subject: [PATCH 08/13] Fixed bad cache on manual quote resend --- .../Microsoft/Controller/TranslatedConnectorController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php index bf2e128..aa41c55 100644 --- a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php +++ b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php @@ -28,7 +28,7 @@ protected function afterConstruct() { $jobValidator = ( new JobPasswordValidator( $this ) ); $jobValidator->onSuccess( function () use ( $jobValidator ) { - $this->job = $jobValidator->getJob(); + $this->job = ( new \Jobs_JobDao() )->read( $jobValidator->getJob()->id )[ 0 ]; $this->project = $this->job->getProject(); } ); From ffac6eb902a385197fb68db181c0fbef7f89f3cd Mon Sep 17 00:00:00 2001 From: Ostico Domenico Lupinetti Date: Fri, 25 May 2018 22:44:43 +0200 Subject: [PATCH 09/13] Fix wrong job dao initialization --- .../Microsoft/Controller/TranslatedConnectorController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php index aa41c55..18ad819 100644 --- a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php +++ b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php @@ -28,7 +28,10 @@ protected function afterConstruct() { $jobValidator = ( new JobPasswordValidator( $this ) ); $jobValidator->onSuccess( function () use ( $jobValidator ) { - $this->job = ( new \Jobs_JobDao() )->read( $jobValidator->getJob()->id )[ 0 ]; + $job = new \Jobs_JobStruct(); + $job->id = $jobValidator->getJob()->id; + $job->password = $jobValidator->getJob()->password; + $this->job = ( new \Jobs_JobDao() )->read( $job )[ 0 ]; $this->project = $this->job->getProject(); } ); From 0b7116d721cd7890f0ab75b0e9c763adad7e3b20 Mon Sep 17 00:00:00 2001 From: Ostico Domenico Lupinetti Date: Fri, 25 May 2018 22:53:00 +0200 Subject: [PATCH 10/13] Renamed Method --- .../Microsoft/Controller/TranslatedConnectorController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php index 18ad819..875e5a4 100644 --- a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php +++ b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php @@ -51,7 +51,7 @@ public function sendJob() { $this->config = Microsoft::getConfig(); - $eq_word = \Jobs_JobDao::getEQWord( $this->job ); + $eq_word = \Jobs_JobDao::getTODOWords( $this->job ); $this->setSuccessMailSender( new ConfirmedQuotationEmail( Microsoft::getPluginBasePath() . '/Features/Microsoft/View/Emails/confirmed_quotation.html' ) ); $this->setFailureMailSender( new ErrorQuotationEmail( Microsoft::getPluginBasePath() . '/Features/Microsoft/View/Emails/error_quotation.html' ) ); From 576f43487ee33ad086c4b5fefb01f4d5c99f7f3d Mon Sep 17 00:00:00 2001 From: riccio82 Date: Mon, 28 May 2018 17:29:11 +0200 Subject: [PATCH 11/13] Hide revise link in translate page --- static/src/css/sass/microsoft-core.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/src/css/sass/microsoft-core.scss b/static/src/css/sass/microsoft-core.scss index 0e59069..33dec9c 100644 --- a/static/src/css/sass/microsoft-core.scss +++ b/static/src/css/sass/microsoft-core.scss @@ -27,7 +27,7 @@ body.review { } } -body.translate { +body:not(.review) { footer { .wrapper nav ul li:nth-child(2) { display: none; From e25e2e158072c370ee3b791d2fa500c459d8c303 Mon Sep 17 00:00:00 2001 From: domenico Date: Wed, 30 May 2018 13:39:30 +0200 Subject: [PATCH 12/13] Changed method name --- .../Microsoft/Controller/TranslatedConnectorController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php index bf2e128..5e1430d 100644 --- a/lib/Features/Microsoft/Controller/TranslatedConnectorController.php +++ b/lib/Features/Microsoft/Controller/TranslatedConnectorController.php @@ -48,7 +48,7 @@ public function sendJob() { $this->config = Microsoft::getConfig(); - $eq_word = \Jobs_JobDao::getEQWord( $this->job ); + $eq_word = \Jobs_JobDao::getTODOWords( $this->job ); $this->setSuccessMailSender( new ConfirmedQuotationEmail( Microsoft::getPluginBasePath() . '/Features/Microsoft/View/Emails/confirmed_quotation.html' ) ); $this->setFailureMailSender( new ErrorQuotationEmail( Microsoft::getPluginBasePath() . '/Features/Microsoft/View/Emails/error_quotation.html' ) ); From 4c20aa83af11be0ceded79ac797781efaceb283d Mon Sep 17 00:00:00 2001 From: riccio82 Date: Wed, 30 May 2018 17:40:52 +0200 Subject: [PATCH 13/13] Overwrite warning modal downloading a file --- static/src/js/cat_source/microsoft-core.extension.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/static/src/js/cat_source/microsoft-core.extension.js b/static/src/js/cat_source/microsoft-core.extension.js index b8d86f2..7103965 100644 --- a/static/src/js/cat_source/microsoft-core.extension.js +++ b/static/src/js/cat_source/microsoft-core.extension.js @@ -1,9 +1,9 @@ - (function(SF, QA_GLOSSARY) { let original_closeFilter = SF.closeFilter; let filte_size = '50'; let filter_type = 'regular_intervals'; + $.extend(UI, { showFixWarningsModal: function ( ) { APP.confirm({ @@ -14,6 +14,16 @@ cancelTxt: 'Mark as complete', msg: 'Unresolved glossary and/or tag issues are preventing you from completing your translation.
Please fix the issues.' }); + }, + showFixWarningsOnDownload( continueDownloadFunction ) { + APP.confirm({ + name: 'confirmDownload', // <-- this is the name of the function that gets invoked? + cancelTxt: 'Fix errors', + onCancel: 'goToFirstError', + callback: continueDownloadFunction, + okTxt: 'Download anyway', + msg: 'Unresolved glossary and/or tag issues may prevent downloading your translation. Please fix the issues.

If you continue downloading, part of the content may be untranslated - look for the string UNTRANSLATED_CONTENT in the downloaded files.' + }); } });