Closed (fixed)
Project:
Bootstrap
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2017 at 23:40 UTC
Updated:
30 Jan 2018 at 16:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lor commentedI meet exactly the same problem with Bootstrap / Dropdown language.
This tips didn't work for me.
https://www.drupal.org/project/dropdown_language/issues/2886977#comment-...
Could you please do something about it?
Thank you !
Comment #3
markhalliwellI pretty sure this is a combination of both Dropdown Language and Bootstrap.
According to https://drupal.stackexchange.com/questions/195545/custom-language-switch..., Dropdown Language should be using a deriver, which it's currently not. See:
\Drupal\language\Plugin\Block\LanguageBlock
\Drupal\language\Plugin\Derivative\LanguageBlock
It could even be a semi-core bug in \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::getLanguageSwitchLinks perhaps?
All it does is clone the URL object, but it never sets the language on it (which may be handled by some deriver magic... I'm not sure).
Regardless, I think just checking for the
languageproperty in the link and then setting it on the Url object in the theme as a final backup should be enough.I'll commit a fix shortly.
Comment #4
markhalliwellComment #5
markhalliwellComment #6
sriman commentedApplied the patch given by markcarver & removed the below if condition in the BootstrapDropdown.php it works like a charm.
to
$element['url']->setOption('language', $element['language']);
Comment #7
skaught#6: is there any reason you've removed the condition check? in my own testing, patch worked as expected.
Comment #8
markhalliwell@sriman is coming from #2868100: Editing translations wrong redirect.
I'm not convinced removing the if statement is the right solution. It exists to ensure the theme doesn't override an explicitly set language option on a URL, which is coming from core/contrib.