If I understood it right, this was at some point working in the 6.1 version (or possibly not) but then the task of translating term labels was moved to entity API. Since there is no entity stuff in 6.x there is no translation happening for taxonomy terms.

I wrote a simple module with two functions which take care of the translation but I'm not really sure where this should go. I'm happy to work on a patch but for what?

Below the two functions which hook into facetapi_map_taxonomy_terms:

/**
 * Implements hook_facetapi_facet_info_alter().
 */
function custom_fan_facetapi_facet_info_alter(array &$facet_info, array $searcher_info) {
//   $translate_node_types = function_exists('i18n_node_type_name');
  foreach ($facet_info as $name => $facet) {
    if ($facet['map callback'] != 'facetapi_map_taxonomy_terms') {
      continue;
    }
    $facet_info[$name]['map callback'] = 'custom_fan_facetapi_map_taxonomy_terms';
  }
}

function custom_fan_facetapi_map_taxonomy_terms(array $values) {
  $untranslated = $map = array();
  foreach($values as $tid) {
    if ($name = i18ntaxonomy_translate_term_name($tid)) {
      $map[$tid] = $name;
    } else {
      $untranslated[] = $tid;
    }
  }
  if (count($untranslated)) {
    $map += facetapi_map_taxonomy_terms($untranslated);
  }
  return $map;
}

Comments

DaPooch’s picture

I'm interested in this also. It would seem the 6x-3 branch of Solr Search Integration and Facets API doesn't have taxonomy faceting working. Am I correct in understanding that implementing an additional custom module with the code you've outlined will allow this to work? Are taxonomy terms actually being indexed by Solr? How can I tell?