diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 07884614a51e6b2d84ae1c91b842bbb83df46200..0138f39644dc00899c49b0c58a2406ff68a3129c 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -630,7 +630,14 @@ function locale_modules_disabled($modules) { */ function locale($string = NULL, $context = NULL, $langcode = NULL) { global $language; - $locale_t = &drupal_static(__FUNCTION__); + + // Use the advanced drupal_static() pattern, since this is called very often. + static $drupal_static_fast; + if (!isset($drupal_static_fast)) { + $drupal_static_fast['locale'] = &drupal_static(__FUNCTION__); + } + $locale_t = &$drupal_static_fast['locale']; + if (!isset($string)) { // Return all cached strings if no string was specified