diff -u b/src/Form/JobForm.php b/src/Form/JobForm.php --- b/src/Form/JobForm.php +++ b/src/Form/JobForm.php @@ -422,13 +422,13 @@ $translator = $job->getTranslator(); // Check translator availability. if (!empty($translator)) { - $result = $translator->isAvailable(); - if (!($result->getSuccess())) { - // $result = new TMGMTResponse(FALSE, t('@translator is not available. Make sure it is properly !configured.'), array('@translator' => $translator->label(), '!configured' => $translator->link(t('configured')))); - $form_state->setErrorByName('translator', $result->getMessage()); + $available_result = $translator->isAvailable(); + $translatable_result = $translator->canTranslate($job); + if (!($available_result->getSuccess())) { + $form_state->setErrorByName('translator', $available_result->getMessage()); } - elseif (!$translator->canTranslate($job)->getSuccess()) { - $form_state->setErrorByName('translator', $translator->canTranslate($job)->getMessage()); + elseif (!($translatable_result->getSuccess())) { + $form_state->setErrorByName('translator', $translatable_result->getMessage()); } } } diff -u b/src/TMGMTResponse.php b/src/TMGMTResponse.php --- b/src/TMGMTResponse.php +++ b/src/TMGMTResponse.php @@ -40,14 +40,11 @@ * Response either TRUE or FALSE. * @param string $message * Message about the error. - * @param array $args - * Associative array of dynamic data that will be inserted into $message. */ - public function __construct($success, $message = "", $args = array()) { + public function __construct($success, $message = "") { $this->success = $success; if (!$success) { $this->message = $message; - $this->args = $args; } } @@ -55,7 +52,7 @@ * Returns the object message. */ public function getMessage() { - $argumented_message = t($this->message, $this->args); + $argumented_message = t($this->message); return $argumented_message; } diff -u b/src/TranslatorPluginBase.php b/src/TranslatorPluginBase.php --- b/src/TranslatorPluginBase.php +++ b/src/TranslatorPluginBase.php @@ -54,7 +54,16 @@ // one of the supported languages. return new TMGMTResponse(TRUE); } - return new TMGMTResponse(FALSE, t('@translator can not translate because is not available', array('@translator' => $translator->label()))); + if ($job->getTranslator()) { + return new TMGMTResponse(FALSE, t('@translator can not translate from @source to @target.', array( + '@translator' => $job->getTranslator()->label(), + '@source' => $job->getSourceLanguage()->getName(), + '@target' => $job->getTargetLanguage()->getName() + ))); + } + else { + return new TMGMTResponse(FALSE, t('@translator can not translate.')); + } } /**