function tmgmt_translator_load_available

Loads all translators that are available and, if a translation job is given, support translations for that job with its current configuration.

Parameters

\Drupal\tmgmt\JobInterface $job: (Optional) A translation job.

Return value

array An array of translators with the machine-readable name of the translators as array keys.

Related topics

1 call to tmgmt_translator_load_available()
tmgmt_job_needs_checkout_form in ./tmgmt.module
Check if a job needs a checkout form. The current checks include if there is more than one translator available, if he has settings and if the job has a fixed target language.

File

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

Code

function tmgmt_translator_load_available($job) {
  $translators = Translator::loadMultiple();
  foreach ($translators as $name => $translator) {
    if (!$translator
      ->checkAvailable()
      ->getSuccess() || isset($job) && !$translator
      ->checkTranslatable($job)
      ->getSuccess()) {
      unset($translators[$name]);
    }
  }
  return $translators;
}