Closed (fixed)
Project:
Search Autocomplete
Version:
7.x-2.3
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 Apr 2012 at 03:14 UTC
Updated:
6 Sep 2012 at 11:39 UTC
Should it work automatically or would I have to enable it?
In #1443646: Multilingual site search it says to add "AND n.language = :curr_lang" to the query. I tried it. This seems to limit the suggestions to the language the user set in his profile. But I want it to use the active language of the site. So if a German user visits the English site, the search should suggest terms in English.
What would I have to change for that?
Related:
#192424: Language sensitive Search Autocomplete
#1443646: Multilingual site search
Comments
Comment #1
dom. commentedHi!
In line 55 in search_autocomplete.module, the :curr_lang callback is replaced by $language->language. From what I see here, it seems it should work:
http://api.drupal.org/api/drupal/developer%21globals.php/global/language/7
#277675: Get current selected language
However, there's a difference between interface language and content language. You might consider changing $language to $language_content if you want the other one. (it's tricky to have a user who choosed German as a language but visits the English website). See here:
http://realguess.net/node/177
The best way would be for you to add a new callback in line 57:
I guess you can determine the priority between site and user language at: admin/config/regional/language/configure but I never really tried!
Miro.
Comment #2
dom. commentedComment #3
dom. commentedComment #4
no2e commentedTo describe my use case:
I use i18n. If someone searches on the English site (example.org/en/…), he only gets English nodes -- no matter which user language he selected in his profile or what language he used for the search query.
So it isn't helpful when it (
AND n.language = :curr_lang) displays the autocomplete terms in the user language, because those search terms only work for the site in that specific language.Do you mean
AND n.language_content = :curr_lang?Or do I have to edit/patch the module?
Comment #5
dom. commentedHi !
See my answer number #1:
I would advice you to patch the module as suggested and use the :site_lang in your SQL query.
This kind of issue so much urgies me to finish 3.x version rapidely ! Using View to build your suggestions would solve all that kind of problems "magically" !
Miro
Comment #6
dom. commentedHi !
Have yuo tried 7.x-3.x ? It should solve your issue using VIEWS to create your suggestion list !