Closed (cannot reproduce)
Project:
Drupal core
Version:
11.x-dev
Component:
locale.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Jul 2010 at 16:09 UTC
Updated:
4 Jul 2023 at 09:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
martin_qDoesn't the query need to be an array? If so, I'd suggest changing
to
as in the attached patch.
Comment #3
jax commentedNo it doesn't. It can be or a string or an array. drupal_query_string_encode() is used in a lot of other places in the same way.
Comment #4
xamountI have applied the original patch and it worked for me. It would be nice if this patch could be submitted...
Comment #6
xamountlocale.patch queued for re-testing.
Comment #7
dddave commented#825264: Language switcher does not preserve query string marked as duplicate.
Also setting to needs works as the patch seems to fail (is testing for D6 back?) and #3 dissents with the direction of the patch.
Comment #8
fprevos2 commentedAny update on this issue?
Comment #9
fprevos2 commentedTry to fix the patch.
Comment #10
dddave commentedComment #11
pawel_r commentedthx, it solved my problems with language switching while using FAQ ASK module. Will it go to main branch?
Comment #12
itamair commentedall this is easily solved using hook_language_switch_links_alter ... and forcing the link/url to keep the 'query' attributes,
as described here https://www.drupal.org/node/1483412#comment-6747320
Comment #13
martin_qYes, that is a reasonable workaround - doesn't "solve" the bug in core, but it fixes the symptoms... :)
Comment #15
Stevel commentedThis seems to be still happening with 7.x. Patch needs to be changed for 7.x using drupal_get_query_parameters and drupal_http_build_query
Comment #16
mvcIn fact, this still happens with 8.x as well.
As a followup to #12 above, a similar workaround is possible in D8:
Comment #18
kbrinnerI too could fix the issue by using the hook_language_switch_links_alter ... and forcing the link/url to keep the 'query' attributes per this comment, but was looking for a fix to Drupal 7 core perhaps? When I tried to look into patching the locale.module for Drupal 7, I made a little progress but ran into another roadblock.
In locale.module, if you do something like the following:
You still don't get the desired result. While the
$pathvariable is set correctly initially, once it is passed through thetheme('links__locale_block', $variables);per the$block['content'], the paths are re-written from the desired path ie [my-page]?term=[tid] to [my-page]%3Fterm%3D[tid]?term=[tid]. In my case this was a Views exposed filter that is filtering per taxonomy terms. The ?term=[tid] seems to get duplicated - replacing the ? and = with the escaped hexadecimal ASCII representations for URL Character codes for the path. It also leaves duplicates the correct query parameter and puts it at the end of the path. At this point the workaround with the hook_language_switch_links_alter works so I won't investigate further, but if anyone knows how to correct the issue with the theme() function rewriting the path incorrectly, I'm sure it would be helpful to many.Comment #22
joseph.olstadfor ideas on how to get a working language switcher that does get parameters properly and handles the various entity types and multiple languages enabled or disabled, see this language switcher for D7, works perfectly.
https://cgit.drupalcode.org/wetkit_language/tree/wetkit_language.module?...
I'm not sure if this is still an issue in D8 core, but apparently it is if this issue is still open.
Comment #32
quietone commentedI tested this on Drupal 11.x today and find that the language switcher does retain the query parameters.
Therefore, closing as cannot reproduce. If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").
Thanks!