Get translated taxonomy

Submitted by root on Thu, 11/05/2020 - 16:31
<?php $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree('vid', 0, NULL, TRUE); $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId(); foreach ($terms as &$term) { if ($term->hasTranslation($current_langcode)) { $term = $term->getTranslation($current_langcode); } } ?>
Arloa