From 42c185e672955c77559223c055263e1bc8d2e865 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Mon, 4 Jan 2010 00:05:18 +0000 Subject: #320686 by Arancaytar and Davy Van Den Bremt: Don't rebuild locale cache when is not set. --- modules/locale/locale.module | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/locale/locale.module b/modules/locale/locale.module index e588fbbb4..b5c3f4173 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -611,8 +611,9 @@ function locale($string = NULL, $context = NULL, $langcode = NULL, $reset = FALS $langcode = isset($langcode) ? $langcode : $language->language; - // Store database cached translations in a static var. - if (!isset($locale_t[$langcode])) { + // Store database cached translations in a static variable. Only build the + // cache after $language has been set to avoid an unnecessary cache rebuild. + if (!isset($locale_t[$langcode]) && isset($language)) { $locale_t[$langcode] = array(); // Disabling the usage of string caching allows a module to watch for // the exact list of strings used on a page. From a performance -- cgit v1.2.3