Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.276
diff -u -p -r1.276 locale.module
--- modules/locale/locale.module	23 Dec 2009 13:28:45 -0000	1.276
+++ modules/locale/locale.module	2 Jan 2010 19:00:09 -0000
@@ -614,8 +614,9 @@ function locale($string = NULL, $context
 
   $langcode = isset($langcode) ? $langcode : $language->language;
 
-  // Store database cached translations in a static var.
-  if (!isset($locale_t[$langcode])) {
+  // Store database cached translations in a static variable. Only build the 
+  // cache after $language has been set to avoid an unnecessary cache rebuild.
+  if (!isset($locale_t[$langcode]) && isset($language)) {
     $locale_t[$langcode] = array();
     // Disabling the usage of string caching allows a module to watch for
     // the exact list of strings used on a page. From a performance
