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

8.0.x
catch 2012-01-03 14:00:32 +09:00
parent 7059b26506
commit aafd8aaf62
1 changed files with 8 additions and 1 deletions

View File

@ -634,7 +634,14 @@ function locale_language_delete($language) {
*/
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