Download & Extend

Make facet links in content type filter and current search block respect translations

Project:Apache Solr Search Integration
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

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);
}

Comments

#1

Status:active» needs review

The node type name is a user submitted dynamic string, therefore it should be translated with tt().
http://drupal.org/node/304002

AttachmentSizeStatusTest resultOperations
612520-1-translate_node_type_facet.patch976 bytesIgnored: Check issue status.NoneNone

#2

The current search block still shows the node type in English..

#3

Title:Make facet links in content type filter respect translations» Make facet links in content type filter and current search block respect translations
Status:needs review» active

@Pasqualle - good points. Can you re-roll to include the current search block?

#4

Status:active» needs work

#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

<?php
if (module_exists())
?>
within reason

#6

This is also related, maybe even a duplicate: #436578: 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

Version:6.x-2.x-dev» 6.x-1.x-dev
Status:needs work» patch (to be ported)

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.

AttachmentSizeStatusTest resultOperations
translatable-type-facet.patch866 bytesIgnored: Check issue status.NoneNone

#9

this patch is not good for the reason described in comment #1

this is a duplicate of #436578: Translated (localized) taxonomy facet blocks which has the good solution

#10

Version:6.x-1.x-dev» 6.x-2.x-dev
Status:patch (to be ported)» closed (duplicate)

Ok, thanks for reminding me. Rolling back and marking this as duplicate.