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.63 diff -u -p -r1.1.2.6.2.111.2.63 apachesolr_search.module --- apachesolr_search.module 26 Apr 2010 03:47:20 -0000 1.1.2.6.2.111.2.63 +++ apachesolr_search.module 26 Apr 2010 13:32:58 -0000 @@ -845,7 +845,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(); @@ -1071,7 +1071,9 @@ function apachesolr_search_get_username( */ function apachesolr_search_get_type($facet) { if ($type = node_get_types('name', $facet)) { - + if (module_exists('i18ncontent')) { + $type = tt("nodetype:type:$type:name", $type); + } } else if ($facet == 'comment') { $type = t('Comment'); @@ -1436,7 +1438,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; } } @@ -1591,3 +1593,57 @@ function apachesolr_search_get_hierarchi return $result; } + +/** + * 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; +}