Skip to content
Snippets Groups Projects
Commit c99eba75 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1387766 by dereine: Added Use fast drupal static pattern for locale.

parent 1c519917
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment