Having a bilingual site here. Some nodes are translated and language switcher works fine. But the switcher block also shows up on nodes which aren't translated. Then the untranslated language link has a different styling.

How can I hide the switcher when there's no (other) translation of the node? I looked up variables in all preprocess functions without finding any indicators. What do I have to look for? And how then can I hide the switcher?

1 Answer 1


In template.php add:

 * hide language switcher if en-gb is not set
function MYTHEME_links__locale_block(&$vars) {
  // made conditional if other languages are added later
  if(!isset($vars['links']['en-gb']['href'])) {
  // here is the condition
  if(count($vars['links']) <= 1) {
    return '';
  } else {
    return theme_links($vars);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.