Index: l10n_community/import.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/l10n_server/l10n_community/Attic/import.inc,v
retrieving revision 1.1.2.5.2.18.2.2
diff -u -r1.1.2.5.2.18.2.2 import.inc
--- l10n_community/import.inc	19 Feb 2010 08:23:05 -0000	1.1.2.5.2.18.2.2
+++ l10n_community/import.inc	8 Mar 2010 22:55:01 -0000
@@ -140,6 +140,28 @@
 }
 
 /**
+ * If the file was already imported return TRUE else write in the db the md5 hash of the file
+ *
+ * @param string $file
+ * @return TRUE|FALSE
+ */
+function l10n_community_get_file_hash($file) {
+  $hash = md5_file($file);
+  $result = db_result(db_query("SELECT 1 FROM {l10n_community_import_files} WHERE md5hash = '%s'", $hash));
+  if ($result) {
+    return TRUE;
+  }
+  else{
+    $record = new stdClass;
+    $record->md5hash = $hash;
+    drupal_write_record('l10n_community_import_files', $record);
+    return FALSE;
+  }
+}
+
+
+
+/**
  * Parses a Gettext Portable Object file and saves strings.
  *
  * Modified version of Drupal 7's _locale_import_read_po():
@@ -166,6 +188,10 @@
     _locale_import_message('The translation import failed, because the file %filename could not be read.', $file);
     return FALSE;
   }
+  elseif (($hash = l10n_community_get_file_hash($file->filepath))) {
+    _locale_import_message('The translation import failed, because the file %filename was already imported.', $file);
+    return FALSE;
+  }
 
   $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR
   $current = array();   // Current entry being read
@@ -359,7 +385,7 @@
 
       // Add this as a suggestion first.
       $tid = l10n_community_add_suggestion($sid, $value['msgstr'], $langcode, $uid);
-      
+
       if ($tid) {
         if ($is_suggestion) {
           l10n_community_counter(L10N_COUNT_SUGGESTED);
@@ -371,8 +397,8 @@
       elseif ($tid === FALSE) {
         l10n_community_counter(L10N_COUNT_DUPLICATE);
       }
-      
-      
+
+
     }
     else {
       // Source string not found, string ignored.
Index: l10n_community/l10n_community.install
===================================================================
RCS file: /cvs/drupal/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.install,v
retrieving revision 1.1.2.11.2.15.2.2
diff -u -r1.1.2.11.2.15.2.2 l10n_community.install
--- l10n_community/l10n_community.install	24 Feb 2010 10:04:10 -0000	1.1.2.11.2.15.2.2
+++ l10n_community/l10n_community.install	8 Mar 2010 22:55:02 -0000
@@ -394,7 +394,23 @@
       'sid_language_has_translation' => array('sid', 'language', 'has_translation'),
     ),
   );
-
+  $schema['l10n_community_import_files'] = array(
+    'fields' => array(
+      'fid' => array(
+        'description' => 'Internal numeric identifier for a imported translation file.',
+        'type' => 'serial',
+        'not null' => TRUE,
+        'disp-width' => '11',
+      ),
+      'md5hash' => array(
+        'description' => 'MD5 hash of a imported translation file',
+        'type' => 'char',
+        'length' => '32',
+        'not null' => TRUE,
+      ),
+    ),
+    'primary key' => array('fid'),
+  );
   return $schema;
 }
 
@@ -708,7 +724,7 @@
       'sid_language_has_translation' => array('sid', 'language', 'has_translation'),
     ),
   ));
-  
+
   // Initialize status flags with values based on the current data.
   $ret[] = update_sql("REPLACE INTO {l10n_community_status_flag} SELECT sid, language, MAX(has_suggestion) AS has_suggestion, MAX(has_translation) AS has_translation FROM (SELECT sid, language, (is_suggestion = 1 and is_active = 1) as has_suggestion, (is_suggestion = 0 and is_active = 1) as has_translation FROM {l10n_community_translation} HAVING has_translation = 1 or has_suggestion = 1) t GROUP BY sid, language;");
   // Drop the has_suggestion field from the translation table.
