Checks whether a translator with a certain name is busy and therefore can't be modified or deleted. A translator is considered 'busy' if there are jobs attached to it that are in an active state.
$translator: The machine-readable name of a translator.
bool TRUE if the translator is busy, FALSE otherwise.
function tmgmt_translator_busy($translator) {
return (bool) \Drupal::entityQuery('tmgmt_job')
->accessCheck(TRUE)
->condition('state', [
Job::STATE_ACTIVE,
Job::STATE_CONTINUOUS,
], 'IN')
->condition('translator', $translator)
->range(0, 1)
->count()
->execute();
}