Index: modules/translation/translation.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v
retrieving revision 1.32
diff -u -p -r1.32 translation.module
--- modules/translation/translation.module	9 Oct 2008 15:15:54 -0000	1.32
+++ modules/translation/translation.module	9 Oct 2008 18:31:39 -0000
@@ -260,7 +260,16 @@ function translation_remove_from_set($no
   if (isset($node->tnid)) {
     if (db_result(db_query('SELECT COUNT(*) FROM {node} WHERE tnid = %d', $node->tnid)) == 1) {
       // There is only one node left in the set: remove the set altogether.
+      $node->translation_change = array(
+        'old_tnid' => $node->tnid,
+        'new_tnid' => 0,
+        // Determine the remaining former member of the translation set.
+        // May be needed e.g. to reassign existing data from the tnid to this nid.
+        'remaining_nid' => db_result(db_query('SELECT nid FROM {node} WHERE tnid = %d', $node->tnid)),
+      );
       db_query('UPDATE {node} SET tnid = 0, translate = 0 WHERE tnid = %d', $node->tnid);
+      // Allow other modules to respond to the removal of this translation set.
+      node_invoke_nodeapi($node, 'translation_change');
     }
     else {
       db_query('UPDATE {node} SET tnid = 0, translate = 0 WHERE nid = %d', $node->nid);
@@ -268,8 +277,13 @@ function translation_remove_from_set($no
       // If the node being removed was the source of the translation set,
       // we pick a new source - preferably one that is up to date.
       if ($node->tnid == $node->nid) {
-        $new_tnid = db_result(db_query('SELECT nid FROM {node} WHERE tnid = %d ORDER BY translate ASC, nid ASC', $node->tnid));
-        db_query('UPDATE {node} SET tnid = %d WHERE tnid = %d', $new_tnid, $node->tnid);
+        $node->translation_change = array(
+          'old_tnid' => $node->tnid,
+          'new_tnid' => db_result(db_query('SELECT nid FROM {node} WHERE tnid = %d ORDER BY translate ASC, nid ASC', $node->tnid)),
+        );
+        db_query('UPDATE {node} SET tnid = %d WHERE tnid = %d', $node->translation_change['new_tnid'], $node->tnid);
+        // Allow other modules to respond to the changed source for this translation set.
+        node_invoke_nodeapi($node, 'translation_change');
       }
     }
   }
