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??
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | user-language-reset-fix-2616052-#4.patch | 1.14 KB | Kamlendra |
| #2 | user-language-reset-fix-2616052-#1.patch | 1.1 KB | Kamlendra |
Comments
Comment #2
Kamlendra commentedI'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
Comment #3
mpotter commentedThis 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
The drupal_add_js for the 'setting' should be done BEFORE the drupal_add_js for the oa_search.js.
Comment #4
Kamlendra commentedHi mpotter,
I've made changes according to your suggestions to follow drupal coding standards.
Lets test if this works.
Comment #5
Argus commentedNo 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..
Comment #6
mpotter commentedCommitted to 38ce297 in oa_search.
Comment #8
PimPeterse commentedAn easier way to solve the problem is to remove the language tag in /admin/config/regional/language/edit/