This is similar to Stef Van Looveren's answer, but instead of loading all the taxonomy term IDs and then checking if each one has a specific translation, I include the language condition in the query.
$vocabulary = 'MY_VOCABULARY_NAME'; $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $tids = \Drupal::entityQuery('taxonomy_term') ->condition('vid', $vocabulary) ->condition('langcode', $language) ->sort('weight') ->execute(); $terms = \Drupal\taxonomy\Entity\Term::loadMultiple($tids); $termList = []; foreach ($terms as $term) { $tid = $term->id(); $translated_term = \Drupal::service('entity.repository')->getTranslationFromContext($term, $language); $termList[$tid] = $translated_term->getName(); }
This would return any term that has the $language translation, while loadByProperties() only returns the entity if the original language is $language.