Steps to reproduce:

  1. Enable Locale and Translation
  2. Add a language, say Italian
  3. Set session as top detection method and enable it
  4. Enable the language switcher block
  5. Enable translation for articles
  6. Create an english article and its italian translation
  7. Switch to italian and visit the english article without using the language switcher links or the node translation links, for example through the frontpage listing

In this case no link is highlighted as active in the language switcher.

CommentFileSizeAuthor
#1 language_switcher-768240-1.patch639 bytesplach

Comments

plach’s picture

Status: Active » Needs review
Issue tags: +CSS, +Quick fix
StatusFileSize
new639 bytes

This is caused by an incorrect CSS definition: session language override URL language, hence an active class, which is tied to the current path, might not always indicate an active language and viceversa.

sun’s picture

Issue tags: -CSS, -Quick fix +append css

This sounds like an issue to me that could happen quite frequently; i.e., not really tied to the session language negotiation.

Problem: The language switcher block does not highlight any language.

Goal: Always highlight the active/corresponding language in the language switcher block.

Details: (please correct me where I'm wrong)
- The currently active language is not highlighted, because the language switcher links only account for the negotiated URL language of the request.
- The URL language negotiation, and therefore the current URL, always dominates the representation of language switcher links, not respecting any other language negotiation (like session).
- Although no URL language was negotiated (and thus, no link is highlighted), a session language was negotiated.
- This seems to be caused by http://api.drupal.org/api/function/theme_links/7:

      if (isset($link['href']) && ($link['href'] == $_GET['q'] ...)
          && (empty($link['language']) || $link['language']->language == $language_url->language)) {
        $class[] = 'active';
      }

Am I missing something?

sun’s picture

Issue tags: -append css

(errr, strange tags here)

StevenWill’s picture

The #1 patch works. I repeated steps 1-7 as listed by plach. I could only repeat the issue when I clicked on a note title listed on the home page. Once i applied the patch the home page listing link produced the correct language highlight in the language select box on the destination page.

StevenWill’s picture

Status: Needs review » Reviewed & tested by the community

Updating status.

plach’s picture

I ain't sure about how this works with recolorable themes.

sun’s picture

#1: language_switcher-768240-1.patch queued for re-testing.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

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