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.93 diff -u -F '^function' -r1.1.2.6.2.111.2.93 apachesolr_search.module --- apachesolr_search.module 13 Sep 2010 15:26:54 -0000 1.1.2.6.2.111.2.93 +++ apachesolr_search.module 28 Sep 2010 18:33:08 -0000 @@ -815,7 +815,7 @@ function apachesolr_search_taxonomy_face } // Check that we have a response and a valid vid. - if (is_object($response->facet_counts->facet_fields->$delta) && ($vocab = taxonomy_vocabulary_load($vid))) { + if (is_object($response->facet_counts->facet_fields->$delta) && ($vocab = apachesolr_search_localize_taxonomy_vocabulary(taxonomy_vocabulary_load($vid)))) { $reflect_hierarchy = apachesolr_search_get_hierarchical_vocabularies(); $contains_active = FALSE; $facets = array(); @@ -1429,7 +1429,7 @@ function theme_apachesolr_breadcrumb_uid */ function theme_apachesolr_breadcrumb_tid($field) { if (function_exists('taxonomy_get_term')) { - if ($term = taxonomy_get_term($field['#value'])) { + if ($term = apachesolr_search_localize_taxonomy_term(taxonomy_get_term($field['#value']))) { return $term->name; } } @@ -1612,3 +1612,36 @@ function apachesolr_search_get_hierarchi return $result; } + +/** + * Localizes a taxonomy term when applicable. + * + * @param $term + * The taxonomy term object to localize. + * @return + * A localized version of the term object, or the unchanged term if no + * localization could be applied. + */ +function apachesolr_search_localize_taxonomy_term($term) { + if (module_exists('i18ntaxonomy') && i18ntaxonomy_vocabulary($term->vid) == I18N_TAXONOMY_LOCALIZE) { + $term->name = i18nstrings("taxonomy:term:{$term->tid}:name", $term->name); + } + return $term; +} + +/** + * Localizes taxonomy vocabulary, if applicable. + * + * @param $vocab + * The taxonomy vocabulary object to localize. + * @return + * The localized version of the vocabulary object, or the unchanged vocabulary + * if no localization could be applied. + */ +function apachesolr_search_localize_taxonomy_vocabulary($vocab) { + if (module_exists('i18ntaxonomy') && i18ntaxonomy_vocabulary($vocab->vid) == I18N_TAXONOMY_LOCALIZE) { + $vocab->name = i18nstrings("taxonomy:vocabulary:{$vocab->vid}:name", $vocab->name); + } + return $vocab; +} +