I have a site with two languages (English and French) and the language switcher block does work but there's a major flaw with it.

All languages that are enabled show. This is fine for multiple languages but for my 2 language site I would like to create the following scenario:

If the current language being viewed is English, the language switcher should only show "French" and if the current language being viewed is French, the language switcher should only display "English".

I tried to fix this with CSS but both of the language links show as being styled with class 'language-link-on active'.

Has anybody found a workaround for how to determine the active language on the page and then have that language in the language switcher be disabled?

As it currently is, there's no way to determine the active language.

Please help ...

Comments

isloan’s picture

In case anyone is interested, here is what I did:

Just before

$block['content'] = theme('links', $links, array());

at the bottom of function locale_block(), I inserted:

// Kill the array element for the current language
global $language;
$CurrentLanguage = $language->language;
unset($links[$CurrentLanguage]);

and that worked perfectly.

tryitonce’s picture

Hi iSloan,

where would I find this in Drupal 6.8 - I tried a search on all files with some of the code you mentioned - but could not find a file with any of that. Might always be good to mention the file name.

Thanks

kalesco’s picture

It's this file:
modules\locale\locale.module

line 595 that has this line: $block['content'] = theme('links', $links, array());