Index: includes/language.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/language.inc,v
retrieving revision 1.23
diff -u -p -r1.23 language.inc
--- includes/language.inc	24 Oct 2009 05:13:43 -0000	1.23
+++ includes/language.inc	13 Nov 2009 15:12:37 -0000
@@ -148,6 +148,7 @@ function language_negotiation_get_switch
       if (!empty($result)) {
         // Allow modules to provide translations for specific links.
         drupal_alter('language_switch_links', $result, $type, $path);
+        reset($result);
         $links = (object) array('links' => $result, 'provider' => $id);
         break;
       }
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.268
diff -u -p -r1.268 locale.module
--- modules/locale/locale.module	10 Nov 2009 17:27:53 -0000	1.268
+++ modules/locale/locale.module	13 Nov 2009 15:12:37 -0000
@@ -884,8 +884,9 @@ function locale_block_view($type) {
   if (drupal_multilingual()) {
     $path = drupal_is_front_page() ? '<front>' : $_GET['q'];
     $links = language_negotiation_get_switch_links($type, $path);
+    $langcode = $GLOBALS[$type]->language;
 
-    if (isset($links->links) && count($links->links > 1)) {
+    if (isset($links->links) && (count($links->links) > 1 || key($links->links) != $langcode)) {
       $class = "language-switcher-{$links->provider}";
       $variables = array('links' => $links->links, 'attributes' => array('class' => array($class)));
       $block['content'] = theme('links', $variables);
Index: modules/locale/locale.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v
retrieving revision 1.51
diff -u -p -r1.51 locale.test
--- modules/locale/locale.test	10 Nov 2009 17:27:53 -0000	1.51
+++ modules/locale/locale.test	13 Nov 2009 15:12:37 -0000
@@ -1056,7 +1056,7 @@ class LanguageSwitchingFunctionalTest ex
   }
 
   function setUp() {
-    parent::setUp('locale');
+    parent::setUp('locale', 'locale_test');
 
     // Create and login user.
     $admin_user = $this->drupalCreateUser(array('administer blocks', 'administer languages', 'translate interface', 'access administration pages'));
@@ -1117,6 +1117,12 @@ class LanguageSwitchingFunctionalTest ex
     }
     $this->assertIdentical($links, array('active' => array('en'), 'inactive' => array('fr')), t('Only the current language list item is marked as active on the language switcher block.'));
     $this->assertIdentical($anchors, array('active' => array('en'), 'inactive' => array('fr')), t('Only the current language anchor is marked as active on the language switcher block.'));
+
+    variable_set('locale_test_language_switch_links_alter', TRUE);
+    $this->drupalGet('');
+    $this->assertText(t('Languages'), t('English home with English link removed: the language switcher is shown.'));
+    $this->drupalGet('fr');
+    $this->assertNoText(t('Languages'), t('French home with English link removed: the language switcher is hidden.'));
   }
 }
 
Index: modules/locale/tests/locale_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/tests/locale_test.module,v
retrieving revision 1.4
diff -u -p -r1.4 locale_test.module
--- modules/locale/tests/locale_test.module	18 Aug 2009 11:22:36 -0000	1.4
+++ modules/locale/tests/locale_test.module	13 Nov 2009 15:12:37 -0000
@@ -17,6 +17,15 @@ function locale_test_locale($op = 'group
 }
 
 /**
+ * Implement hook_language_switch_links_alter().
+ */
+function locale_test_language_switch_links_alter(&$links, $type, $path) {
+  if (variable_get('locale_test_language_switch_links_alter')) {
+    unset($links['en']);
+  }
+}
+
+/**
  * For testing domain language negotiation, we fake it by setting
  * the HTTP_HOST here
  */
