How do I programmatically get all the terms within a vocabulary for the current language?

This is a similar question to Get translated term name, but not for a single term, but for the entire tree.

1 Answer 1


Two issues here:

  1. Getting the current language, and
  2. Getting the terms for the current language

1. Getting the current language

Use the global $language variable and get its language property:


2. Getting the terms for the current language

In theory, you'd use i18n_taxonomy_get_tree, like so:

global $language;
$tree = i18n_taxonomy_get_tree(1, $language->language,0,NULL,FALSE);

but it seems that function is buggy. Instead, you can try using i18n_taxonomy_localize_terms with taxonomy_get_tree instead:

if (module_exists('i18n_taxonomy')) { // Check if the module exists
    global $language;
    $tree = i18n_taxonomy_localize_terms(taxonomy_get_tree($VID,0,NULL,FALSE));
} else {
    $tree = taxonomy_get_tree($VID,0,NULL,FALSE);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.