Make facet links in content type filter and current search block respect translations
robertDouglass - October 23, 2009 - 09:22
| Project: | Apache Solr Search Integration |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
function apachesolr_search_get_type($facet) {
$type = node_get_types('name', $facet);
// A disabled or missing node type returns FALSE.
- return ($type === FALSE) ? $facet : $type;
+ return ($type === FALSE) ? $facet : t($type);
}

#1
The node type name is a user submitted dynamic string, therefore it should be translated with tt().
http://drupal.org/node/304002
#2
The current search block still shows the node type in English..
#3
@Pasqualle - good points. Can you re-roll to include the current search block?
#4
#5
I really like the technique aufumy has started using for all these
like here: #606862: node type information to be translatable.
He has done it for a number of projects
Essentially, creating an 'apachesolr_tt' function that wraps the tt() function. keeps the number of
<?phpif (module_exists())
?>
#6
This is also related, maybe even a duplicate: #436578: Add support for translated (localized) taxonomy facet blocks
#7
The real place to address this for node types is the facet callback, which is:
function apachesolr_search_get_type($facet) {$type = node_get_types('name', $facet);
// A disabled or missing node type returns FALSE.
return ($type === FALSE) ? $facet : $type;
}
Which might possibly be acceptable for us to be changed as:
function apachesolr_search_get_type($facet) {$type = node_get_types('name', $facet);
// A disabled or missing node type returns FALSE.
return ($type === FALSE) ? $facet : t($type);
}
#8
Committing the attached. Marking to be ported. The patch won't apply to 6.1 but the code from pwolanin's comment above can be used.
#9
this patch is not good for the reason described in comment #1
this is a duplicate of #436578: Add support for translated (localized) taxonomy facet blocks which has the good solution
#10
Ok, thanks for reminding me. Rolling back and marking this as duplicate.