--- C:/Documents and Settings/juanr/Desktop/localizer.module1	Sat Nov 17 15:51:38 2007
+++ W:/cemper/modules/localizer/localizer.module	Sat Nov 17 15:31:15 2007
@@ -400 +400,8 @@
-  $output = theme('item_list', localizer_block_switchuilocale_links(variable_get('localizer_switchblock_showflags', TRUE), variable_get('localizer_switchblock_showlangname',TRUE), variable_get('localizer_switchblock_flagseparator', ' ')));
+	
+	//Ensure at least one link is returned to avoid theming with no content
+	$links = localizer_block_switchuilocale_links(variable_get('localizer_switchblock_showflags', TRUE), variable_get('localizer_switchblock_showlangname',TRUE), variable_get('localizer_switchblock_flagseparator', ' '));
+	if ($links != '')
+  	$output = theme('item_list', $links);
+  else
+  	$output = '';
+  
@@ -421,0 +429,6 @@
+			//Check that the node has a translation for this locale
+			//otherwise don't show that link
+			$orig_node = $_GET['q'];		
+			$dest_node = localizernode_get_localizedpath($_GET['q'], $lang);
+			if ($orig_node!='' && $orig_node!='node' && $orig_node == $dest_node) continue;
+
@@ -791,0 +805 @@
+
@@ -830 +844,2 @@
-      if($localebyhostname != $pathlocale) {
+
+      if($localebyhostname != $pathlocale && $pathlocale!='') {
@@ -832,0 +848,10 @@
+          
+          //If the node doesn't provide any translation
+          //get the right domain for the page and redirect
+          if ($_GET['q'] == $destination)
+          {
+          	//Get the node with its name instead of its number
+          	global $base_path;
+          	$localized_node = localizer_get_destination($pathlocale);
+          	$destination = 'http://'.variable_get('localizer_switch_hostname_'.$pathlocale,$currenthost).$base_path.$localized_node;
+          }
