Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.241
diff -u -p -r1.241 locale.module
--- modules/locale/locale.module	27 May 2009 18:33:58 -0000	1.241
+++ modules/locale/locale.module	5 Jun 2009 19:10:39 -0000
@@ -343,17 +343,10 @@ function locale_theme() {
  *   used on the page.
  * @param $langcode
  *   Language code to use for the lookup.
- * @param $reset
- *   Set to TRUE to reset the in-memory cache.
  */
-function locale($string = NULL, $langcode = NULL, $reset = FALSE) {
+function locale($string = NULL, $langcode = NULL) {
   global $language;
-  static $locale_t;
-
-  if ($reset) {
-    // Reset in-memory cache.
-    $locale_t = NULL;
-  }
+  $locale_t = &drupal_static(__FUNCTION__);
 
   if (!isset($string)) {
     // Return all cached strings if no string was specified
@@ -430,6 +423,13 @@ function locale($string = NULL, $langcod
 }
 
 /**
+ * Reset static variables used by locale().
+ */
+function locale_reset() {
+  drupal_static_reset('locale');
+}
+
+/**
  * Returns plural form index for a specific number.
  *
  * The index is computed from the formula of this language.
@@ -442,12 +442,13 @@ function locale($string = NULL, $langcod
  */
 function locale_get_plural($count, $langcode = NULL) {
   global $language;
-  static $locale_formula, $plurals = array();
+  $locale_formula = &drupal_static(__FUNCTION__, array());
+  $plurals = &drupal_static(__FUNCTION__, array());
 
   $langcode = $langcode ? $langcode : $language->language;
 
   if (!isset($plurals[$langcode][$count])) {
-    if (!isset($locale_formula)) {
+    if (empty($locale_formula)) {
       $language_list = language_list();
       $locale_formula[$langcode] = $language_list[$langcode]->formula;
     }
@@ -469,7 +470,7 @@ function locale_get_plural($count, $lang
  * Returns a language name
  */
 function locale_language_name($lang) {
-  static $list = NULL;
+  $list = &drupal_static(__FUNCTION__);
   if (!isset($list)) {
     $list = locale_language_list();
   }
Index: modules/locale/locale.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v
retrieving revision 1.24
diff -u -p -r1.24 locale.test
--- modules/locale/locale.test	27 May 2009 11:45:00 -0000	1.24
+++ modules/locale/locale.test	5 Jun 2009 19:10:39 -0000
@@ -214,7 +214,7 @@ class LocaleTranslationFunctionalTest ex
     // Add string.
     t($name, array(), $langcode);
     // Reset locale cache.
-    locale(NULL, NULL, TRUE);
+    locale_reset();
     $this->assertText($langcode, t('Language code found.'));
     $this->assertText($name, t('Name found.'));
     $this->assertText($native, t('Native found.'));
@@ -407,7 +407,7 @@ class LocaleTranslationFunctionalTest ex
     // Add string.
     t($name, array(), $langcode);
     // Reset locale cache.
-    locale(NULL, NULL, TRUE);
+    locale_reset();
     $this->drupalLogout();
 
     // Search for the name.
