Loads all translators that are available and, if a translation job is given, support translations for that job with its current configuration.
\Drupal\tmgmt\JobInterface $job: (Optional) A translation job.
array An array of translators with the machine-readable name of the translators as array keys.
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;
}