Drupal - How to change the behaviour or display of the language switcher?
Add next into template.php file of your theme:
<?php
function YOURTHEMENAME_links__locale_block($variables) {
foreach($variables['links'] as $key => $lang) {
if (isset($lang['attributes']['class']) && in_array('locale-untranslated', $lang['attributes']['class'])) {
// Set here any page link.
$variables['links'][$key]['href'] = '<front>';
}
}
return theme_links($variables);
}
there is a module for this now - Language Switcher Fallback. Does exactly what you asked, directing the user to the frontpage if no translation to a node. See here https://drupal.org/project/language_switcher_fallback