summaryrefslogtreecommitdiff
path: root/modules/locale
diff options
context:
space:
mode:
Diffstat (limited to 'modules/locale')
-rw-r--r--modules/locale/locale.module9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 07884614a..0138f3964 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