--- i18nsync.module.orig	2007-06-06 13:54:18.000000000 +0200
+++ i18nsync.module	2008-04-04 13:08:46.000000000 +0200
@@ -163,16 +163,46 @@ function i18nsync_node_translation($node
           }
         }
         break;
-      default: // For fields that don't need special handling
-        if (isset($node->$field)) {
-          $translation->$field = $node->$field;
-        }
+      default: // For other fields
+       if (isset($node->$field) && $_field = $node->$field) {
+         // For nodereference fields !IT'S RAW METHOD, MAY NEED REVIEW!
+         if (isset($_field[0]['nid']) && $_field[0]['nid'] != $node->nid ) {
+           i18nsync_node_translation_referenced_node(&$node, &$translation, $field);
+         } else {
+           // For fields that don't need special handling
+           $translation->$field = $node->$field;
+         }
+       }
     }
   }
   node_save($translation);
 }
 
 /**
+ * Node reference that may have translation
+ *
+ */
+function i18nsync_node_translation_referenced_node(&$node, &$translation, $field) {
+$translation->$field = array();
+  $_field = $node->$field;
+  foreach ($_field as $key=>$reference) {
+    if ($referenced = node_load($reference['nid'])) {
+      // This content type has translations, find the one
+      if (variable_get("i18n_node_$referenced->type", 0) && isset($referenced->translation[$translation->language])) {
+        array_push($translation->$field, array('nid'=>$referenced->translation[$translation->language]->nid));
+        drupal_set_message(t('%title referenced node has been synchronized to %language translation',array('%title'=>$referenced->title, '%language'=>$translation->language)));
+      } else {
+        // Reference without translation, just copy the nid
+        array_push($translation->$field, $_field[$key]);
+      }
+    } else {
+      // False reference nid, just copy the nid
+      array_push($translation->$field, $_field[$key]);
+    }
+  }
+}
+
+/**
  * Node attachments that may have translation
  * 
  */
