Commit 42c185e6 authored by webchick's avatar webchick
Browse files

#320686 by Arancaytar and Davy Van Den Bremt: Don't rebuild locale cache when is not set.

parent 311a25ca
...@@ -611,8 +611,9 @@ function locale($string = NULL, $context = NULL, $langcode = NULL, $reset = FALS ...@@ -611,8 +611,9 @@ function locale($string = NULL, $context = NULL, $langcode = NULL, $reset = FALS
$langcode = isset($langcode) ? $langcode : $language->language; $langcode = isset($langcode) ? $langcode : $language->language;
// Store database cached translations in a static var. // Store database cached translations in a static variable. Only build the
if (!isset($locale_t[$langcode])) { // cache after $language has been set to avoid an unnecessary cache rebuild.
if (!isset($locale_t[$langcode]) && isset($language)) {
$locale_t[$langcode] = array(); $locale_t[$langcode] = array();
// Disabling the usage of string caching allows a module to watch for // Disabling the usage of string caching allows a module to watch for
// the exact list of strings used on a page. From a performance // the exact list of strings used on a page. From a performance
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment