Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.275
diff -u -p -r1.275 locale.module
--- modules/locale/locale.module	7 Dec 2009 05:02:37 -0000	1.275
+++ modules/locale/locale.module	15 Dec 2009 07:16:03 -0000
@@ -612,6 +612,12 @@ function locale($string = NULL, $context
     return $locale_t;
   }
 
+  if ($string === '') {
+    // Avoid checking for empty strings and also creating empty strings in the
+    // translation database.
+    return '';
+  }
+
   $langcode = isset($langcode) ? $langcode : $language->language;
 
   // Store database cached translations in a static var.
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.238
diff -u -p -r1.238 locale.inc
--- includes/locale.inc	9 Dec 2009 15:35:48 -0000	1.238
+++ includes/locale.inc	15 Dec 2009 07:17:44 -0000
@@ -1931,29 +1931,33 @@ function _locale_import_one_string($op, 
     case 'db-store':
       // We got header information.
       if ($value['msgid'] == '') {
-        $header = _locale_import_parse_header($value['msgstr']);
-
-        // Get the plural formula and update in database.
-        if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->uri)) {
-          list($nplurals, $plural) = $p;
-          db_update('languages')
-            ->fields(array(
-              'plurals' => $nplurals,
-              'formula' => $plural,
-            ))
-            ->condition('language', $lang)
-            ->execute();
-        }
-        else {
-          db_update('languages')
-            ->fields(array(
-              'plurals' => 0,
-              'formula' => '',
-            ))
-            ->condition('language', $lang)
-            ->execute();
+        if ($header_done) {
+          watchdog('locale', 'An empty message ID string was found during .po import.  The string was dropped.', array(), WATCHDOG_WARNING);
+        } else {
+          $header = _locale_import_parse_header($value['msgstr']);
+
+          // Get the plural formula and update in database.
+          if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->uri)) {
+            list($nplurals, $plural) = $p;
+            db_update('languages')
+              ->fields(array(
+                'plurals' => $nplurals,
+                'formula' => $plural,
+              ))
+              ->condition('language', $lang)
+              ->execute();
+          }
+          else {
+            db_update('languages')
+              ->fields(array(
+                'plurals' => 0,
+                'formula' => '',
+              ))
+              ->condition('language', $lang)
+              ->execute();
+          }
+          $header_done = TRUE;
         }
-        $header_done = TRUE;
       }
 
       else {
@@ -2473,9 +2477,9 @@ function _locale_parse_js_file($filepath
  */
 
 /**
- * Generates a structured array of all strings with translations in
- * $language, if given. This array can be used to generate an export
- * of the string in the database.
+ * Generates a structured array of all non-empty source strings with
+ * translations in $language, if given. This array can be used to generate an
+ * export of the string in the database.
  *
  * @param $language
  *   Language object to generate the output for, or NULL if generating
@@ -2485,10 +2489,10 @@ function _locale_parse_js_file($filepath
  */
 function _locale_export_get_strings($language = NULL, $group = 'default') {
   if (isset($language)) {
-    $result = db_query("SELECT s.lid, s.source, s.context, s.location, t.translation, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.textgroup = :textgroup ORDER BY t.plid, t.plural", array(':language' => $language->language, ':textgroup' => $group));
+    $result = db_query("SELECT s.lid, s.source, s.context, s.location, t.translation, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.textgroup = :textgroup AND s.source != '' ORDER BY t.plid, t.plural", array(':language' => $language->language, ':textgroup' => $group));
   }
   else {
-    $result = db_query("SELECT s.lid, s.source, s.context, s.location, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid WHERE s.textgroup = :textgroup ORDER BY t.plid, t.plural", array(':textgroup' => $group));
+    $result = db_query("SELECT s.lid, s.source, s.context, s.location, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid WHERE s.textgroup = :textgroup AND s.source != '' ORDER BY t.plid, t.plural", array(':textgroup' => $group));
   }
   $strings = array();
   foreach ($result as $child) {
