- 🇳🇿New Zealand quietone
I tested this on Drupal 10.1.x, standard install, with English, Italian and German. I was able to reproduce the problem.
I applied the latest patch at #2775651-41: No active language in language switcher for URL with query string → and that does work. I do not know if it is the correct fix.
- 🇩🇪Germany Anybody Porta Westfalica
Thanks @quietone, for that reason I reopened the issue you linked, as it doesn't seem to have been a duplicate then. We should check both issues for a solution and if it is or should be combined fix or not.
I have a multilingual site, but my background admin page uses only one language, using '$current_language_code = $this->languageManager->getCurrentLanguage()->getId(); 'will not get the exact language, So I'll change it to '$current_language_code = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId();' , using the url to determine the language.
- 🇮🇳India manish.upadhyay
Hi Everyone,
Here is the updated patch for 9.5.x.
Thanks,
- 🇦🇹Austria enorm
Hello and thank you for your work!
One issue for drupal 9.5 and the language switcher when 403 or 404 pages:
Result of the patch #32: Only the
<a
gets the is-active class BUT for a working lang-switcher you also need the parent<li
as active!the html should look like this:
<ul class="links list-unstyled mb-0"> <li hreflang="de" data-drupal-link-system-path="node/956" class="is-active"> <a href="/de/start" class="language-link is-active" hreflang="de" data-drupal-link-system-path="node/956">Deutsch</a> </li><li hreflang="en" data-drupal-link-system-path="node/956"> <a href="/en/node/956" class="language-link" hreflang="en" data-drupal-link-system-path="node/956">English</a> </li></ul>
please can you have a look again at this problem for a new patch, thanks, Erich!
- First commit to issue fork.
- Merge request !12862Issue #2802371 Add active state to LanguageBlock using current language. → (Open) created by karengrey
- 🇬🇧United Kingdom karengrey
This is still an issue for 11.x
Have created a MR based on the patches created previously. - 🇬🇧United Kingdom nicrodgers Monmouthshire, UK
Thanks for creating the MR @karengrey. We've been using the various patches in production successfully for years, however the issue is still tagged with NeedsTests so I'm going to set this back to Needs Work for now. Hopefully we can get some tests written and get this issue wrapped up.