Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.111.2.8
diff -u -r1.1.2.6.2.111.2.8 apachesolr_search.module
--- apachesolr_search.module	23 Aug 2009 16:38:43 -0000	1.1.2.6.2.111.2.8
+++ apachesolr_search.module	24 Aug 2009 17:20:55 -0000
@@ -685,7 +685,7 @@
               }
               $unclick_link = '';
               unset($active);
-              $term = taxonomy_get_term($tid);
+              $term = apachesolr_search_localize_taxonomy_term(taxonomy_get_term($tid));
               $new_query = clone $query;
               if ($active = $query->has_filter('tid', $tid)) {
                 $contains_active = TRUE;
@@ -706,7 +706,7 @@
             }
           }
           $vid = substr($delta, 7);
-          $vocab = taxonomy_vocabulary_load($vid);
+          $vocab = apachesolr_search_localize_taxonomy_vocabulary(taxonomy_vocabulary_load($vid));
           if (is_numeric($vid) && is_array($terms) && isset($terms[$vid]) && is_array($terms[$vid])) {
             ksort($terms[$vid]);
             $limit = isset($initial_limits['apachesolr_search'][$delta]) ? $initial_limits['apachesolr_search'][$delta] : $limit_default;
@@ -791,6 +791,60 @@
 }
 
 /**
+ * Localizes taxonomy term
+ *
+ * @param $term
+ *   The taxonomy term object to localize.
+ * @return
+ *   A localized version of the term object.
+ */
+function apachesolr_search_localize_taxonomy_term($term) {
+  if (apachesolr_search_taxonomy_needs_localization($term)) {
+    $term->name = tt("taxonomy:term:$term->tid:name", $term->name);
+  }
+  return $term;
+}
+
+/**
+ * Localizes taxonomy vocabulary
+ *
+ * @param $vocab
+ *   The taxonomy vocabulary object to localize.
+ * @return
+ *   The localized version of the vocabulary object.
+ */
+function apachesolr_search_localize_taxonomy_vocabulary($vocab) {
+  if (apachesolr_search_taxonomy_needs_localization($vocab)) {
+    $vocab->name = tt("taxonomy:vocabulary:$vocab->vid:name", $vocab->name);
+  }
+  return $vocab;
+}
+
+/**
+ * Detects if taxonomy object should be localized
+ *
+ * @param $obj 
+ *   A taxonomy vocabulary or term object.
+ * @return
+ *   TRUE if the object should be localized.
+ */
+function apachesolr_search_taxonomy_needs_localization($obj) {
+  static $localize = array();
+
+  if (module_exists('i18ntaxonomy')) {
+    if (empty($localize)) {
+      $localize = i18ntaxonomy_vocabulary(NULL, I18N_TAXONOMY_LOCALIZE);
+    }
+  }
+
+  if (in_array($obj->vid, $localize)) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+/**
  * Callback function for the 'Filter by book' facet block.
  */
 function apachesolr_search_get_book($facet, &$options) {
@@ -819,6 +873,9 @@
 function apachesolr_search_get_type($facet) {
   $type = node_get_types('name', $facet);
   // A disabled or missing node type returns FALSE.
+  if ($type && module_exists('i18ncontent')) {
+    $type = tt("nodetype:type:$type:name", $type);
+  }
   return ($type === FALSE) ? $facet : $type;
 }
 
@@ -1132,7 +1189,7 @@
  * Return the term name from $tid.
  */
 function theme_apachesolr_breadcrumb_tid($tid) {
-  $term = taxonomy_get_term($tid);
+  $term = apachesolr_search_localize_taxonomy_term(taxonomy_get_term($tid));
   return $term->name;
 }
 

