A client has a vocabulary containing various topics in two languages. Most of the terms are assigned to one of two languages but since there are topic which spell the same in both languages there are also language neutral terms. In order to just display terms of current language (or neutral ones) I changed one function in the module:


function jump_menu_get_taxo_options(&$options, $vid) {
  $tree = taxonomy_get_tree($vid);
  global $language;
  $lang = $language->language;
  foreach ($tree as $term) {
    if ( $term->language == $lang || $term->language == '' ) {
      $options[taxonomy_term_path($term)] = $term->name;
    }
  }
}

Best,
Paul

Comments

nicholas.alipaz’s picture

Version: 6.x-1.0 » 6.x-2.x-dev

This feature didn't get into 1.x. We are glad to accept a new patch against 2.x branch.

dmirtillo’s picture

That function is identical in the 2.x branch, so no need for a new patch.

Also: the metod posted by Paul.B only works for mixed language vocabs that do not contain translatable terms (each term has a fixed language).

I am working with vocabularies that have translatable terms, so i had to adjust the function like this:

function jump_menu_get_taxo_options(&$options, $vid) {
  global $language;
  $lang = $language->language;
  $tree = taxonomy_get_tree($vid);
  foreach ($tree as $term) {
	$translated_name = i18nstrings("taxonomy:term:$term->tid:name", $term->name, $lang);
    $options[taxonomy_term_path($term)] = $translated_name;
  }
}