Hi Drupalista,

I've a multilingual site which has 2 languages one is English running at www.example.com/en and another is french running at www.example.com/fr

Now, what oa_search module does is it checks the condition for search and then sends the search keyword to user or node according to the condition.

i.e. www/example.com/search/node/[search_keyword] or
www.example/com/search/user/[search_keyword]

I've found the following code (inside root/profiles/openatrium/modules/apps/oa_search/oa_search.js) responsible for this behaviour:

var path = Drupal.settings.basePath + 'search' + '/' + (type === 'users' ? 'user' : 'node') + '/' + term;

The issue is every time I search a keyword the search is redirected to
www.example.com/search/node/[search_keyword] instead of www.example.com/[language_keyword]/search/node/[search_keyword]

as a result of which user's language is reset after making a search.

How to solve this problem??

Comments

Kamlendra created an issue. See original summary.

Kamlendra’s picture

StatusFileSize
new1.1 KB

I've created a patch to solve this problem as of now it works fine to suite my requirements i.e. search keyword now works with the site language not being changed to default.
Please leave a feedback to improve this patch.

Thanks

mpotter’s picture

Status: Active » Needs work
  1. +++ b/js/oa_search.js
    @@ -54,7 +54,10 @@
    +    if(lang)
    

    This need to be cleaned up to follow Drupal coding standards. You need a { } block, a space after "if" and fixing the indent of the "var path" line

  2. +++ b/oa_search.module
    @@ -140,4 +140,7 @@ function oa_search_add_js() {
    +  drupal_add_js(array('sitelang' => $lang_prefix ), 'setting');
    

    The drupal_add_js for the 'setting' should be done BEFORE the drupal_add_js for the oa_search.js.

Kamlendra’s picture

StatusFileSize
new1.14 KB

Hi mpotter,

I've made changes according to your suggestions to follow drupal coding standards.
Lets test if this works.

Argus’s picture

Priority: Major » Normal
Status: Needs work » Needs review
Issue tags: -multilingual, -search, -OpenAtrium

No need to add tags. This doesn't effect a majority of users, so lowering priority to Normal. Please update to the latest version of OA and update the Version number in this issue if the issue isn't resolved..

mpotter’s picture

Status: Needs review » Fixed

Committed to 38ce297 in oa_search.

Status: Fixed » Closed (fixed)

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

PimPeterse’s picture

An easier way to solve the problem is to remove the language tag in /admin/config/regional/language/edit/