From 955dcf2bef05bace97c63a415212004fc073d722 Mon Sep 17 00:00:00 2001
From: Axel Rutz <axel.rutz@clever-systems.net>
Date: Sat, 17 May 2014 14:10:52 +0200
Subject: [PATCH] Issue #2269503 by axel.rutz: Translation overview page:
 Allow exact match.

---
 includes/locale.inc             |    8 ++++----
 modules/locale/locale.admin.inc |    5 +++--
 modules/locale/locale.test      |    2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/includes/locale.inc b/includes/locale.inc
index c168da0..27191bf 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -1876,12 +1876,12 @@ function _locale_translate_seek() {
   // Compute LIKE section.
   switch ($query['translation']) {
     case 'translated':
-      $sql_query->condition('t.translation', '%' . db_like($query['string']) . '%', 'LIKE');
+      $sql_query->condition('t.translation', $query['string'], 'LIKE');
       $sql_query->orderBy('t.translation', 'DESC');
       break;
     case 'untranslated':
       $sql_query->condition(db_and()
-        ->condition('s.source', '%' . db_like($query['string']) . '%', 'LIKE')
+        ->condition('s.source', $query['string'], 'LIKE')
         ->isNull('t.translation')
       );
       $sql_query->orderBy('s.source');
@@ -1889,10 +1889,10 @@ function _locale_translate_seek() {
     case 'all' :
     default:
       $condition = db_or()
-        ->condition('s.source', '%' . db_like($query['string']) . '%', 'LIKE');
+        ->condition('s.source', $query['string'], 'LIKE');
       if ($query['language'] != 'en') {
         // Only search in translations if the language is not forced to English.
-        $condition->condition('t.translation', '%' . db_like($query['string']) . '%', 'LIKE');
+        $condition->condition('t.translation', $query['string'], 'LIKE');
       }
       $sql_query->condition($condition);
       break;
diff --git a/modules/locale/locale.admin.inc b/modules/locale/locale.admin.inc
index b736f79..b023bbb 100644
--- a/modules/locale/locale.admin.inc
+++ b/modules/locale/locale.admin.inc
@@ -812,8 +812,8 @@ function locale_translation_filters() {
   unset($languages['en']);
 
   $filters['string'] = array(
-    'title' => t('String contains'),
-    'description' => t('Leave blank to show all strings. The search is case sensitive.'),
+    'title' => t('String'),
+    'description' => t('Use "_" to match any character, "%" to match any number of characters. Use "\_" for"_", "\%" for "%". The search is case sensitive.'),
   );
 
   $filters['language'] = array(
@@ -856,6 +856,7 @@ function locale_translation_filter_form() {
         '#type' => 'textfield',
         '#title' => $filter['title'],
         '#description' => $filter['description'],
+        '#default_value' => '%',
       );
     }
     else {
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 9ffec9f..0851c0f 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -2307,7 +2307,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
 
     // We will look for this string in the admin/config screen to see if the
     // corresponding translated string is shown.
-    $default_string = 'Configure languages for content and the user interface';
+    $default_string = 'Configure languages for content and the user interface.';
 
     // Set the default language in order for the translated string to be registered
     // into database when seen by t(). Without doing this, our target string
-- 
1.7.9.5

