You are here

13 March 2012

How to get term name in right language in Drupal? Internationalization (i18n) module is used for localization.

Source code viewer
  1. global $language; // load current user language
  2.  
  3. $vocabulary = taxonomy_vocabulary_machine_name_load('vocabulary_name');
  4. $terms = taxonomy_get_tree($vocabulary->vid, 0, 1);
  5. foreach($terms as $term)
  6. echo i18n_taxonomy_term_name($term, $language->language);
Programming Language: PHP