Index: translate.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/translate.inc,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 translate.inc
--- translate.inc	28 Dec 2007 16:40:12 -0000	1.1.2.5
+++ translate.inc	21 Apr 2008 13:45:53 -0000
@@ -465,6 +465,7 @@ function l10n_community_translate_form_s
   global $user;
 
   $inserted = $updated = $unchanged = $suggested = 0;
+  $duplicates = array();
   foreach ($form as $sid => $item) {
     if (!is_array($item) || !isset($item['translation'])) {
       // Skip, if we don't have translations in this form item,
@@ -487,8 +488,16 @@ function l10n_community_translate_form_s
         $text = '';
       }
     }
-      
+
     if ($text) {
+      // Check for duplicate translations.
+      $result = db_query("SELECT {l10n_community_string}.value FROM {l10n_community_string}, {l10n_community_translation} WHERE {l10n_community_translation}.translation = '%s' AND {l10n_community_string}.sid = {l10n_community_translation}.sid", $text);
+      if (db_num_rows($result) > 0) {
+        // Duplicate translation.
+        $original = db_fetch_object($result);
+        array_push($duplicates, l10n_community_format_text($original->value));
+        continue;
+      }
       // We have some string to save.
       l10n_community_target_save(
         $sid, $text, $form['langcode'], $user->uid,
@@ -497,6 +506,15 @@ function l10n_community_translate_form_s
       );
     }
   }
+  // We have duplicates, inform user.
+  if (!empty($duplicates)) {
+    $strings = '<ul>';
+    foreach($duplicates as $duplicate) {
+      $strings .= '<li>'. $duplicate .'</li>';
+    }
+    $strings .= '</ul>';
+    drupal_set_message(t("Duplicate translation or suggestion exists for the following strings. If their translation is incorrect, please suggest a different one.\n!strings", array('!strings' => $strings)), 'status');
+  }
   
   // Inform user about changes made to the database.
   l10n_community_update_message($inserted, $updated, $unchanged, $suggested);
