diff --git a/modules/locale.module b/modules/locale.module
index 8a1c3e1ac4a48842b6295bf13fa093a7f3f387d1..43fd0658707ede3eddbecc54661a6353df082a92 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -83,9 +83,11 @@ function locale_admin() {
 
 function locale($string) {
   global $locale;
-  $result = db_query("SELECT id, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0");
-  if ($translation = db_fetch_object($result)) $string = ($translation->$locale) ? check_output($translation->$locale) : $string;
-  else db_query("INSERT INTO locales (string, location) VALUES ('". addslashes($string) ."', '". check_input(getenv("REQUEST_URI")) ."')");
+  if ($locale) {
+    $result = db_query("SELECT id, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0");
+    if ($translation = db_fetch_object($result)) $string = ($translation->$locale) ? check_output($translation->$locale) : $string;
+    else db_query("INSERT INTO locales (string, location) VALUES ('". addslashes($string) ."', '". check_input(getenv("REQUEST_URI")) ."')");
+  }
   return $string;
 }
 
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 8a1c3e1ac4a48842b6295bf13fa093a7f3f387d1..43fd0658707ede3eddbecc54661a6353df082a92 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -83,9 +83,11 @@ function locale_admin() {
 
 function locale($string) {
   global $locale;
-  $result = db_query("SELECT id, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0");
-  if ($translation = db_fetch_object($result)) $string = ($translation->$locale) ? check_output($translation->$locale) : $string;
-  else db_query("INSERT INTO locales (string, location) VALUES ('". addslashes($string) ."', '". check_input(getenv("REQUEST_URI")) ."')");
+  if ($locale) {
+    $result = db_query("SELECT id, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0");
+    if ($translation = db_fetch_object($result)) $string = ($translation->$locale) ? check_output($translation->$locale) : $string;
+    else db_query("INSERT INTO locales (string, location) VALUES ('". addslashes($string) ."', '". check_input(getenv("REQUEST_URI")) ."')");
+  }
   return $string;
 }