In a multilingual installation, the block returns a number of nodes that are in different languages -- particularly when there are names involved in the titles. Is there any way to restrict the search to only articles in the current user's language?

Comments

Dr Jay’s picture

Category: feature » bug

I'm changing this to a bug report as there is a problem in the code. Around line 170:

 if (module_exists('localizer')) {           
        $nodes = do_search($search_key, 'node', 'LEFT JOIN {localizernode} loc ON loc.nid=i.sid',
          "(loc.locale IN ('". $locale ."','-') OR loc.locale IS NULL)");

But the localizer module has been deprecated since the 5.x branch and replaced with internationalization (i18n). So for 6.x installations, this code needs to be revised in order to work correctly on multilingual sites.

spiderman’s picture

Assigned: Unassigned » spiderman
Status: Active » Needs work

I've started working on this, and appear to have it working in what I imagine is the simplest possible use-case. The multilanguage stuff in core now makes this easier, but the i18n module has many configuration options, which makes this feature a little tricky.

I'd love to hear any feedback about common usage scenarios for this, or options you'd like to see the module provide, I'll fill in a more detailed feature. Meantime, I'm going to think this through and research i18n a little more to make an educated guess at the best way to approach this.

spiderman’s picture

Title: Restrict search to current language » Support core $language settings and i18n content selection mode
Version: 6.x-1.x-dev » 6.x-1.0
Status: Needs work » Fixed

This turned out to not be too hard at all. With the new global $language variable in 6.x, I could provide basic support for language-sensitive "relevance" with a trivial change to the do_search() query. I've gone one step further and added default support for i18n module's "content selection mode" so that it reflects content based on the site-wide selection for what content languages to display by default.

I have committed this feature and rolling it into a 1.1 release, but would love to have some feedback and testing on how it might be tweaked or made more useful. Patches always welcome :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.