diff --git a/includes/locale.inc b/includes/locale.inc
index 1d8880b..f0a08e5 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -1307,7 +1307,18 @@ function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NUL
 
       else {
         // Some real string to import.
-        $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
+        $location = '';
+        if ($group == 'default') {
+          // If the text group is the Built-in, then the location is not important.
+          $location = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
+        }
+        else {
+          $location = _locale_import_textgroup_location(empty($value['#']) ? array() : $value['#']);
+          if (!$location) {
+            $report['skips']++;
+            return;
+          }
+        }
 
         if (strpos($value['msgid'], "\0")) {
           // This string has plural versions.
@@ -1322,7 +1333,7 @@ function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NUL
             if ($key == 0) {
               $plid = 0;
             }
-            $plid = _locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key);
+            $plid = _locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $location, $mode, $plid, $key);
           }
         }
 
@@ -1330,7 +1341,7 @@ function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NUL
           // A simple string to import.
           $english = $value['msgid'];
           $translation = $value['msgstr'];
-          _locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
+          _locale_import_one_string_db($report, $lang, $english, $translation, $group, $location, $mode);
         }
       }
   } // end of db-store operation
@@ -1362,7 +1373,13 @@ function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NUL
  *   The string ID of the existing string modified or the new string added.
  */
 function _locale_import_one_string_db(&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid = NULL, $plural = NULL) {
-  $lid = db_result(db_query("SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'", $source, $textgroup));
+  $query = "SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'";
+  $args = array($source, $textgroup);
+  if ($textgroup != 'default') {
+    $query .= " AND location = '%s'";
+    $args[] = $location;
+  }
+  $lid = db_result(db_query($query, $args));
 
   if (!empty($translation)) {
      // Skip this string unless it passes a check for dangerous code.
@@ -1390,7 +1407,7 @@ function _locale_import_one_string_db(&$report, $langcode, $source, $translation
     else {
       // No such source string in the database yet.
       db_query("INSERT INTO {locales_source} (location, source, textgroup) VALUES ('%s', '%s', '%s')", $location, $source, $textgroup);
-      $lid = db_result(db_query("SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'", $source, $textgroup));
+      $lid = db_result(db_query("SELECT lid FROM {locales_source} WHERE location = '%s' AND source = '%s' AND textgroup = '%s'", $location, $source, $textgroup));
       db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural);
       $report['additions']++;
     }
@@ -1671,7 +1688,37 @@ function _locale_import_shorten_comments($comment) {
       break;
     }
   }
-  return substr($comm, 0, -2);
+  return substr(trim($comm), 0, -1);
+}
+
+/**
+ * Get the location identifier from the comment array.
+ *
+ * @param $comment
+ *   An array of strings containing a comment
+ * @return
+ *   If the location is finded then return it, else return an empty string.
+ */
+function _locale_import_textgroup_location($comment) {
+  // Regex positive lookbehind ~1-8% slower than the grouped
+  // Match key = 0
+  // /(?<=^:\s)[a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+){1,}$/
+
+  // Regex grouped
+  // Match key = 1
+  // /:\s([a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+){1,})/
+
+  $location = '';
+  $matches = NULL;
+  $i = count($comment);
+  while (!$location && $i--) {
+    if (preg_match('/:\s([a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+){1,})/', $comment[$i], $matches)) {
+      // _locale_import_read_po() read 10*1024 bytes, but the database column length is 255.
+      // _locale_import_shorten_comments() trim this string to 130.
+      $location = substr($matches[1], 0, 255);
+    }
+  }
+  return $location;
 }
 
 /**
