Index: modules/translation/translation.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v
retrieving revision 1.40
diff -u -p -r1.40 translation.module
--- modules/translation/translation.module	8 Mar 2009 04:25:07 -0000	1.40
+++ modules/translation/translation.module	9 Mar 2009 02:14:40 -0000
@@ -200,8 +200,18 @@ function translation_node_prepare($node)
         (user_access('translate content'))) {
       // We are translating a node from a source node, so
       // load the node to be translated and populate fields.
+      $source_node = node_load($source_nid);
+      // Ensure we don't have an existing translation in this language.
+      if (!empty($source_node->tnid)) {
+        $translations = translation_node_get_translations($source_node->tnid);
+        if (isset($translations[$language])) {
+          $languages = language_list();
+          drupal_set_message(t('A translation of %title in %language already exists, a new %type  will be created instead of a translation.', array('%title' => $source_node->title, '%language' => $languages[$language]->name, '%type' => $node->type)), 'error');
+          return;
+        }
+      }
       $node->language = $language;
-      $node->translation_source = node_load($source_nid);
+      $node->translation_source = $source_node;
       $node->title = $node->translation_source->title;
       $node->body = $node->translation_source->body;
       // Let every module add custom translated fields.
@@ -249,6 +259,22 @@ function translation_node_update($node) 
 }
 
 /**
+ * Implementation of hook_node_validate().
+ *
+ * Ensure that duplicate translations can not be created for the same source.
+ */
+function translation_node_validate($node, $form) {
+  // Only act on translatable nodes with a tnid or translation_source.
+  if (translation_supported_type($node->type) && (!empty($node->tnid) || !empty($form['#node']->translation_source->nid))) {
+    $tnid = !empty($node->tnid) ? $node->tnid : $form['#node']->translation_source->nid;
+    $translations = translation_node_get_translations($tnid);
+    if (isset($translations[$node->language]) && $translations[$node->language]->nid != $node->nid ) {
+      form_set_error('language', t('There is already a translation in this language.'));
+    }
+  }
+}
+
+/**
  * Implementation of hook_node_delete().
  */
 function translation_node_delete($node) {
Index: modules/translation/translation.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.test,v
retrieving revision 1.7
diff -u -p -r1.7 translation.test
--- modules/translation/translation.test	30 Dec 2008 16:43:19 -0000	1.7
+++ modules/translation/translation.test	9 Mar 2009 02:14:40 -0000
@@ -50,6 +50,21 @@ class TranslationTestCase extends Drupal
     $node_translation_body = $this->randomName();
     $node_translation = $this->createTranslation($node->nid, $node_translation_title, $node_translation_body, 'es');
 
+    // Attempt to submit a duplicate translation by visiting the node/add page
+    // with identical query string.
+    $languages = language_list();
+    $this->drupalGet('node/add/page', array('query' => array('translation' => $node->nid, 'language' => 'es')));
+    $this->assertRaw(t('A translation of %title in %language already exists', array('%title' => $node_title, '%language' => $languages['es']->name)), t('Message regarding attempted duplicate translation is displayed.'));
+
+    // Attempt a resubmission of the form - this emulates using the back button
+    // to return to the page then resubmitting the form without a refresh.
+    $edit = array();
+    $edit['title'] = $this->randomName();
+    $edit['body'] = $this->randomName();
+    $this->drupalPost('node/add/page', $edit, t('Save'), array('query' => array('translation' => $node->nid, 'language' => 'es')));
+    $duplicate = $this->drupalGetNodeByTitle($edit['title']);
+    $this->assertEqual($duplicate->tnid, 0, t('The node does not have a tnid.'));
+
     // Update original and mark translation as outdated.
     $edit = array();
     $edit['body'] = $this->randomName();
