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

Pasqualle - October 23, 2009 - 12:22
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

AttachmentSize
612520-1-translate_node_type_facet.patch 976 bytes

#2

Pasqualle - October 23, 2009 - 12:30

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

#3

robertDouglass - October 23, 2009 - 17:09
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

robertDouglass - October 23, 2009 - 17:09
Status:active» needs work

#5

Scott Reynolds - October 23, 2009 - 17:20

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

janusman - October 26, 2009 - 16:21

This is also related, maybe even a duplicate: #436578: Add support for translated (localized) taxonomy facet blocks

#7

pwolanin - November 12, 2009 - 21:43

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

robertDouglass - November 25, 2009 - 16:46
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.

AttachmentSize
translatable-type-facet.patch 866 bytes

#9

Pasqualle - November 25, 2009 - 18:06

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

robertDouglass - November 25, 2009 - 18:57
Version:6.x-1.x-dev» 6.x-2.x-dev
Status:patch (to be ported)» duplicate

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

 
 

Drupal is a registered trademark of Dries Buytaert.