From 4442af7a0bac2930bf44b95b41535d885d37d49a Mon Sep 17 00:00:00 2001
From: Bob Vincent <bobvin@pillars.net>
Date: Tue, 7 Jun 2011 20:09:52 -0400
Subject: [PATCH] Issue #504506 by andypost, pillarsdotnet: Drupal.formatPlural followup.

---
 includes/locale.inc |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/includes/locale.inc b/includes/locale.inc
index 0ca9944f51bff06006cb6deb957aae2850d30980..fc11fae32b3fffb89ded4e735ed47f2f190a23bf 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -1863,7 +1863,17 @@ function _locale_rebuild_js($langcode = NULL) {
 
   // Construct the array for JavaScript translations.
   // Only add strings with a translation to the translations array.
-  $result = db_query("SELECT s.lid, s.source, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.location LIKE '%.js%' AND s.textgroup = :textgroup AND t.translation IS NOT NULL", array(':language' => $language->language, ':textgroup' => 'default'));
+  // $result = db_query("SELECT s.lid, s.source, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.location LIKE '%.js%' AND s.textgroup = :textgroup", array(':language' => $language->language, ':textgroup' => 'default'));
+  $select = db_select('locales_source', 's');
+  $t = $select->addJoin(
+    'INNER', 'locales_target', 't',
+    's.lid=t.lid AND t.language=:language',
+    array(':language' => $language->language));
+  $select->fields('s', array('lid', 'source'));
+  $select->fields($t, array('translation'));
+  $select->condition('s.location', '%.js%', 'LIKE');
+  $select->condition('s.textgroup', 'default');
+  $result = $select->execute();
 
   $translations = array();
   foreach ($result as $data) {
-- 
1.7.4.1

