Index: stringoverrides.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/stringoverrides/Attic/stringoverrides.module,v
retrieving revision 1.5.2.4.2.4
diff -u -r1.5.2.4.2.4 stringoverrides.module
--- stringoverrides.module	22 Apr 2008 17:11:33 -0000	1.5.2.4.2.4
+++ stringoverrides.module	22 Apr 2008 23:49:32 -0000
@@ -45,6 +45,31 @@
       'access' => user_access('administer string overrides'),
       'type' => MENU_NORMAL_ITEM,
     );
+    $items[] = array(
+      'path' => 'admin/settings/stringoverrides/overrides',
+      'title' => t('Overrides'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('stringoverrides_admin'),
+      'access' => user_access('administer string overrides'),
+      'type' => MENU_DEFAULT_LOCAL_TASK,
+      'weight' => -10,
+    );
+    $items[] = array(
+      'path' => 'admin/settings/stringoverrides/import',
+      'title' => t('Import'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('stringoverrides_admin_import'),
+      'access' => user_access('administer string overrides'),
+      'type' => MENU_LOCAL_TASK,
+    );
+    $items[] = array(
+      'path' => 'admin/settings/stringoverrides/export',
+      'title' => t('Export'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('stringoverrides_admin_export'),
+      'access' => user_access('administer string overrides'),
+      'type' => MENU_LOCAL_TASK,
+    );
   }
   elseif (strpos($_GET['q'], 'admin/settings/stringoverrides') === 0) {
     include_once(drupal_get_path('module', 'stringoverrides') .'/stringoverrides.admin.inc');
@@ -81,7 +106,7 @@
     	return $strings[$string];
     }
     else {
-    	return $string;
+      return $string;
     }
 	}
 }
Index: stringoverrides.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/stringoverrides/Attic/stringoverrides.admin.inc,v
retrieving revision 1.1.2.2.2.4
diff -u -r1.1.2.2.2.4 stringoverrides.admin.inc
--- stringoverrides.admin.inc	14 Mar 2008 19:00:55 -0000	1.1.2.2.2.4
+++ stringoverrides.admin.inc	22 Apr 2008 23:49:32 -0000
@@ -115,3 +115,105 @@
   $output .= drupal_render($form);
   return $output;
 } // function theme_stringoverrides_strings
+
+/**
+ * Menu callback for the String Overrides module to display the import administration
+ */
+function stringoverrides_admin_import() {
+  $form = array();
+  $form['#attributes'] = array('enctype' => "multipart/form-data");
+  $form['file'] = array(
+    '#type' => 'file',
+    '#title' => t('Import *.po File'),
+    '#description' => t('Attach your *.po file here to import the string overrides.'),
+  );
+  $form['import'] = array(
+    '#type' => 'submit',
+    '#value' => t('Import'),
+    '#weight' => 3,
+  );
+  return $form;
+} // function stringoverrides_admin_import
+
+/**
+ * Triggered when the user imports data
+ */
+function stringoverrides_admin_import_submit($form_id, $form_values) {
+  // Check if the file uploaded correctly
+  if ($file = file_check_upload('file')) {
+    $overrides = array();
+  
+    // Start reading the file
+    $handle = @fopen($file->filepath, "r");
+    if ($handle) {
+      $currentoverride = NULL;
+      $currentstring = NULL;
+      $operation = 'msgstr';
+      
+      // Loop through the whole file
+      while (!feof($handle)) {
+        // Retrieve a single line
+        $buffer = trim(fgets($handle));
+        // Skip empty or comment lines
+        if (empty($buffer) || $buffer[0] == '#') {
+          continue;
+        }
+        // Continued string
+        if ($buffer[0] == '"') {
+          // See what we're reading in
+          $string = trim(substr($buffer, 1, -1));
+          if ($operation == 'msgstr' && !empty($string)) {
+            $currentstring .= $string;
+          }
+          else {
+            $currentoverride .= $string;
+          }
+        }
+        else if (substr($buffer, 0, 6) == 'msgstr') {
+          // Retrieve the override string
+          $operation = 'msgstr';
+          $currentstring = substr($buffer, 8, -1);
+        }
+        else if (substr($buffer, 0, 5) == 'msgid') { // New string
+          // Save old string
+          if (!empty($currentstring) && !empty($currentoverride)) {
+            $overrides[$currentoverride] = $currentstring;
+            $currentoverride = $currentstring = '';
+          }
+          // Read what's next
+          $operation = 'msgid';
+          $currentoverride = substr($buffer, 7, -1);
+        }
+      }
+      
+      // Clean up and save the imported data
+      fclose($handle);
+      file_delete($file->filepath);
+      dvm($overrides);
+      variable_set('locale_custom_strings_en', $overrides);
+    }
+  }
+  else {
+    form_set_error('file', t('A file to import is required.'));
+  }
+} // function stringoverrides_admin_import_submit
+
+/**
+ *
+ */
+function stringoverrides_admin_export() {
+  $form = array();
+  
+  $export = '';
+  $overrides = variable_get('locale_custom_strings_en', array());
+  foreach ($overrides as $override => $string) {
+    $export .= 'msgid "'. $override ."\"\nmsgstr \"$string\"\n";
+  }
+  $form['overrides'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Export'),
+    '#default_value' => $export,
+    '#description' => t('This is the generated *.po file.'),
+  );
+  return $form;
+} // function stringoverrides_admin_export
Index: .project
===================================================================
RCS file: .project
diff -N .project
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .project	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>String Overrides 5</name>
+	<comment></comment>
+	<projects>
+		<project>Drupal 5</project>
+	</projects>
+	<buildSpec>
+	</buildSpec>
+	<natures>
+	</natures>
+</projectDescription>
