Index: import.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/import.inc,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 import.inc
--- import.inc	23 Dec 2007 22:51:53 -0000	1.1.2.5
+++ import.inc	5 May 2008 07:38:08 -0000
@@ -78,7 +78,7 @@ function l10n_community_import_form_subm
       // Get status report on what was done in the process.
       list($inserted, $updated, $unchanged, $suggested) = _l10n_community_import_one_string();
       drupal_set_message(t('The translation was successfully imported.'));
-      l10n_community_update_message($inserted, $updated, $unchanged, $suggested);
+      l10n_community_update_message($inserted, $updated, $unchanged, $suggested, 0);
     }
   }
   else {
Index: l10n_community.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.module,v
retrieving revision 1.1.2.20
diff -u -p -r1.1.2.20 l10n_community.module
--- l10n_community.module	25 Apr 2008 18:18:52 -0000	1.1.2.20
+++ l10n_community.module	5 May 2008 07:38:08 -0000
@@ -742,7 +742,7 @@ function l10n_community_trim($translatio
  * 
  * Used by both the save and import process.
  */
-function l10n_community_update_message($inserted, $updated, $unchanged, $suggested) {
+function l10n_community_update_message($inserted, $updated, $unchanged, $suggested, $duplicates) {
   // Inform user about changes made.
   $message = array();
   if ($inserted) {
@@ -757,6 +757,9 @@ function l10n_community_update_message($
   if ($unchanged) {
     $message[] = format_plural($unchanged, '1 translation unchanged', '@count translations unchanged');
   }
+  if ($duplicates) {
+    $message[] = format_plural($duplicates, '1 duplicate translation not saved', '@count duplicate translations not saved');
+  }
   if (count($message)) {
     drupal_set_message(join(', ', $message) .'.');
   }
@@ -856,3 +859,16 @@ function theme_l10n_community_button($ty
   }
   return ' <span class="'. $class .' l10n-button"'. (!empty($extras) ? (' '. $extras) : '') .'><b><b>'. $text .'</b></b></span>';
 }
+/*
+ * Check if new translation or suggestion is duplicate (already exists).
+ */
+function l10n_is_duplicate($string, $sid, $langcode) {
+  // Check for duplicate translations.
+  $result = db_query("SELECT s.sid FROM {l10n_community_string} s LEFT JOIN {l10n_community_translation} t ON s.sid = t.sid WHERE t.translation = '%s' AND t.is_active = 1 AND t.language = '%s' AND s.sid = '%d'", $string, $langcode, $sid);
+  if (db_num_rows($result) > 0) {
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
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	5 May 2008 07:38:08 -0000
@@ -464,7 +464,10 @@ function l10n_community_translate_form($
 function l10n_community_translate_form_submit($form_id, &$form) {
   global $user;
 
-  $inserted = $updated = $unchanged = $suggested = 0;
+  $inserted = $updated = $unchanged = $suggested = $duplicates = 0;
+
+  $langcode = arg(2);
+
   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 +490,13 @@ function l10n_community_translate_form_s
         $text = '';
       }
     }
-      
-    if ($text) {
+
+    if (!empty($text)) {
+      // Check for duplicate translation or suggestion.
+      if (l10n_is_duplicate($text, $sid, $langcode)) {
+        $duplicates++;
+        continue;
+      } 
       // We have some string to save.
       l10n_community_target_save(
         $sid, $text, $form['langcode'], $user->uid,
@@ -499,7 +507,7 @@ function l10n_community_translate_form_s
   }
   
   // Inform user about changes made to the database.
-  l10n_community_update_message($inserted, $updated, $unchanged, $suggested);
+  l10n_community_update_message($inserted, $updated, $unchanged, $suggested, $duplicates);
 }
 
 // = Theme functions ===========================================================
