You are here

public function TMGMTGoogleTranslatorPluginController::canTranslate in TMGMT Translator Google 7

Overrides TMGMTDefaultTranslatorPluginController::canTranslate().

Overrides TMGMTDefaultTranslatorPluginController::canTranslate

File

./tmgmt_google.plugin.inc, line 67
Provides Google Translator plugin controller.

Class

TMGMTGoogleTranslatorPluginController
Google translator plugin controller.

Code

public function canTranslate(TMGMTTranslator $translator, TMGMTJob $job) {
  if (!parent::canTranslate($translator, $job)) {
    return FALSE;
  }
  foreach (array_filter(tmgmt_flatten_data($job
    ->getData()), '_tmgmt_filter_data') as $value) {

    // If one of the texts in this job exceeds the max character count the job
    // can't be translated.
    if (drupal_strlen($value['#text']) > $this->maxCharacters) {
      return FALSE;
    }
  }
  return TRUE;
}