--- drupal-5.5 (original)/includes/locale.inc	2007-05-21 02:20:02.000000000 +0200
+++ head/includes/locale.inc	2008-01-02 03:19:38.000000000 +0100
@@ -357,6 +357,15 @@
     '#default_value' => ($query->searchin ? $query->searchin : 'all'),
     '#options' => array('all' => t('All strings in that language'), 'translated' => t('Only translated strings'), 'untranslated' => t('Only untranslated strings')),
   );
+  
+  $form['search']['location'] = array('#type' => 'textfield',
+    '#title' => t('Restrict to location'),
+    '#default_value' => $query->location,
+    '#size' => 30,
+    '#maxlength' => 30,
+    '#description' => t('Leave blank to show all strings. The search is case sensitive.') .' '. t('If the first character is ^ then the remaining string must <em>not</em> be present, for a location to match.'),
+  );
+  
   $form['search']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
   $form['#redirect'] = FALSE;
 
@@ -1318,7 +1327,7 @@
   static $query;
 
   if (!isset($query)) {
-    $fields = array('string', 'language', 'searchin');
+    $fields = array('string', 'language', 'searchin', 'location');
     $query = new stdClass();
     if (is_array($_REQUEST['edit'])) {
       foreach ($_REQUEST['edit'] as $key => $value) {
@@ -1368,11 +1377,27 @@
         break;
     }
 
+    $location_where = $location = '';
+    if (!empty($query->location)) {
+      if (substr($query->location, 0, 1) == '^') {
+        //negative search
+        $location = substr($query->location, 1);
+        $location_where = " AND s.location NOT LIKE '%%%s%%'";
+      } else {
+        $location = $query->location;
+        $location_where = " AND s.location LIKE '%%%s%%'";
+      }
+      $where .= $location_where;
+      $arguments[] = $location;
+    }
+
     switch ($query->language) {
       // Force search in source strings
       case "en":
-        $sql = $join ." WHERE s.source LIKE '%%%s%%' ORDER BY s.source";
+        $sql = $join ." WHERE s.source LIKE '%%%s%%' $location_where ORDER BY s.source";
         $arguments = array($query->string); // $where is not used, discard its arguments
+        if ($location_where != '') //has restriction on location:
+          $arguments[] = $location;
         break;
       // Search in all languages
       case "all":
