You are here

function tmgmt_translator_labels_flagged in Translation Management Tool 7

Same name and namespace in other branches
  1. 8 tmgmt.module \tmgmt_translator_labels_flagged()

Returns a list of flagged translator labels. If a translator is not available it will be suffixed with a short text explaining why it is not available. This can either be because the configuration of the passed job is not supported or because the translator service can't be reached.

Parameters

TMGMTJob $job: (Optional) A translation job.

Return value

array An array of flagged translator labels.

Related topics

1 call to tmgmt_translator_labels_flagged()
tmgmt_job_form in ui/includes/tmgmt_ui.pages.inc
Entity API form the job entity.

File

./tmgmt.module, line 1065
Main module file for the Translation Management module.

Code

function tmgmt_translator_labels_flagged($job = NULL) {
  $labels = array();
  foreach (tmgmt_translator_load_multiple(FALSE) as $translator) {
    if (!$translator
      ->isAvailable()) {
      $labels[$translator->name] = t('@label (not available)', array(
        '@label' => $translator
          ->label(),
      ));
    }
    elseif (isset($job) && !$translator
      ->canTranslate($job)) {
      $labels[$translator->name] = t('@label (unsupported)', array(
        '@label' => $translator
          ->label(),
      ));
    }
    else {
      $labels[$translator->name] = $translator
        ->label();
    }
  }
  return $labels;
}