I've just installed this module.
The link in the select are wrongs: there are three languages but every link is to the current language.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arrubiu created an issue. See original summary.

SKAUGHT’s picture

  1. most importantly: do you have translated content for that page? (wether its a node/view/pagemanager)
  2. try adding a rtl language. is the page 'flipped' as would be expected
  3. can you add screen shot of the html source? are the links prefixed with the langauge

some other related info please

  1. what version of drupal core are you using.
  2. what other modules do you have enabled with your setup
  3. what overrides might your .theme be introducing
SKAUGHT’s picture

Status: Active » Closed (cannot reproduce)
MLZR’s picture

Hello SKAUGHT,

Thank you for making this module. I was working with it on drupal 8.2. Now I have update everything; drupal to 8.3, the theme and all modules. Now the languge dropdown is not working porperly anymore. All links are to the same (the current) language.

When I test on Bartik then it is OK! But I use Bootstrap 8.x-3.5 as Theme. I have made a sub-theme bud with the basic theme (not the subtheme so no problems in the sub- theme in the game anymore) I have the same issue. So there is something happeling with Drupal 8.3/ plain Bootstrap theme 3.5 / and your module. I have try'd your module 1.2 and the dev as they are on the drupal site. When I switched the version of the module I also delete the files for a clean install as possible.

I am trying now for a couple of hours bud I can't figure out what is the problem. The Drupal default Language switcher is working properly eg. has the good links. Bud that has not the drop- down... :-|

See the image. Can you tell me what is going on? Is this a bug somewhere or is there something wrong in the settings..

hope you can set me on the right track..

ps. the provided printscreen is from a node with at least English and Dutch.
Thanks, Marchello

MLZR’s picture

FileSize
50.22 KB
SKAUGHT’s picture

i am aware of how much the bootstrap theme alter drupal's output. off hand, i'll point at one of its alters causing this interferance. please open an issue bootstrap... as this sound similar to another issue on that project

--EDIT
personally, i really dislike bootstrap theme for all theses sorts of alterations.. myself, i never use that theme base.

SKAUGHT’s picture

Status: Closed (cannot reproduce) » Closed (won't fix)

changing status. i do beleive in playing well with others.. but i feel this is due to the others.
cheers.

MLZR’s picture

Status: Closed (won't fix) » Closed (cannot reproduce)

Hi SKAUGHT,
Thans for your superfast response!

I am currently still fiddling out whats happening. And I have some news: I have the latest Drupal (8.3.6 ) and the latest bootstrap theme (8.x-3.5). The version of your module is the only one I don't have updatet yet. It is 8x 1.0. This works!!

When I update this module to 1.2 then it's broken and produces only links for the current language.

I am making a website and it is finished. Then I upadate all: drupal + all modules. Then it is ready to go online. In this procedure all updates are OK and working. Exept this module. And the key/solution is in changes between 1.0 and 1.2 ..

Maybe you want to think this one over?

Thanks,
Marchello

SKAUGHT’s picture

Status: Closed (cannot reproduce) » Needs work

i have just run through core 8.3.6, bootstrap 3.5 and drop1.2 and yes, under bootstrap theme it does not work. yet, under bartik it does as expected. again, i'll have to place blame on bootstrap, as indeed, it is re-writting the crap out of my modules output.

yet it does seem , reverting to tag 1.0 does seem to work still..

this seems to track back to the url change in #2824903: Language switch does not work with session language detection.

at this point, i'm open to suggestions. (: $language_manager->getLanguageSwitchLinks seems to have some weaknesses. perhaps there's a option in the class we're missing at this time.

--EDIT
in terms of bootstrap.. for your project, perhaps any alterations to template_preprocess_links should be looked into. for now you'll have to use v1 of dropdown_language, as no commits are security related it shouldn't matter what version your using. i guess -- sorry!

SKAUGHT’s picture

Version: 8.x-1.1 » 8.x-1.2
Priority: Normal » Minor
MLZR’s picture

Thank you SKAUGHT. Thanks again for your quick response.

Now I am exploring the other module "Language Switcher Dropdown". This works (dropdown + correct links), bud I can't get the flag Icon's work. So this is also a path with some hassle. Still looking at this.

One option I will explore is the core language switcher, and theme these with twig to make it a dropdown. Bud I don't know if I can get that to work.

If Both options above don't work I will use your module in version 1.

Your suggestion to look at the code is no-go for me, a am not a coder unfortunately. And I will look into the bootstrap theme for issues related to this..

So, some work to do..
thanks, Marchello

SKAUGHT’s picture

i imagine this all has to do with something taking the URL and outputting it to String[Url->toString] this seems to be killing the language option (which adds the language prefix).

personally, i'm not sure even now how stable Language Switcher Dropdown is (which is why i wrote this module..at the time it wasn't event a release). none the less, i'll hedge a bet that bootstrap it is as much a problem for how they are working with icons as however bootstrap is re-writing 'all the things' as most of the classes i've put in for the li elements are cleared off too in bootstrap.

bootstrap!!! curses!.

SKAUGHT’s picture

Language Switcher Dropdown

    $route = $this->pathMatcher->isFrontPage() ? '<front>' : '<current>';
    $url = Url::fromRoute($route);
    list(, $type) = explode(':', $this->getPluginId());
    $languages = $this->languageManager->getLanguageSwitchLinks($type, $url);

i'm using

$links = $this->languageManager->getLanguageSwitchLinks("language_interface", Url::fromRoute('<current>'))->links;

of course, Language Switcher Dropdown is a form (that is submitted) not links...

SKAUGHT’s picture

Title: Wrong links » Wrong links (preprocessed by theme)
SKAUGHT’s picture

i think the problem is coming form the intertwining of the URL class object not being processing route_name in bootstrap, but using URI.. which (i think) is producing the same path for each link once reprocessed.

i've opened #2901106: Multilingual dropbutton links do not contain correct language identifier with bootstrap.

MLZR’s picture

Hi SKAUGHT,
thank you.

When my dropdown was not working I tried different paths to fix that, also the path to theme the core language links to a dropdown. And that is working now.

I followed this procedure (with the ".theme file"):
https://drupal.stackexchange.com/questions/199290/how-do-i-alter-a-langu...

For me this is working now. So my case is not urgent anymore, I want to let you know that. And maybe you can use this info to tackle the problem in your module.

Thanks thanks,
Marchello

SKAUGHT’s picture

(: a theme alteration fixed with a theme alteration. kool.

SKAUGHT’s picture

Status: Needs work » Closed (works as designed)

closing.

of course theme level alterations to core elements (or other relative alters to block outputs) would 'break' any contrib module from that certain standpoint.

sketman’s picture

Have you please seen this module? As a reference to a potential solution... Bootstrap Languages

SKAUGHT’s picture

sorry, that is a drupal 7 module -- it won't help us here.

lor’s picture

Hi @marchellodepello,

Could you tell us how do you exactly solve this problem because the code of your example doesn't work for me.

Thank you!

markhalliwell’s picture

Title: Wrong links (preprocessed by theme) » Block should use deriver when using getLanguageSwitchLinks
Priority: Minor » Major
Status: Closed (works as designed) » Active
SKAUGHT’s picture

thanks Mark. i'ld come across the tie to deriver's as something todo with the problem while working on caching #2889957: Dropdown language block caching issues.

SKAUGHT’s picture

committed on 8.x-1.x-dev 393b51cc69aaf85dea83ec5110705c06810a72ea

SKAUGHT’s picture

Status: Active » Needs review
markhalliwell’s picture

It should be noted that this is technically a breaking change. Adding a deriver creates new block identifiers, thus breaking any site that may currently use the old block identifier. Perhaps this needs to be in a new 8.x-2.x branch? Or maybe you can create an update hook of some kind.

SKAUGHT’s picture

a great point i hadn't yet tested out existing site setup. hopefully an update hook will do.

SKAUGHT’s picture

SKAUGHT’s picture

Version: 8.x-1.2 » 8.x-1.x-dev
SKAUGHT’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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