diff options
author | cash <cash.costello@gmail.com> | 2012-01-25 20:19:33 -0500 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2012-01-25 20:19:33 -0500 |
commit | df535f87fbf6641bcadc2ffaa01846cad4cd9524 (patch) | |
tree | e3efe5fc0abab51894de120e1d6e865f0d29ae97 | |
parent | 62a356615c690e4020ef143332270ee57525b2c4 (diff) | |
download | elgg-df535f87fbf6641bcadc2ffaa01846cad4cd9524.tar.gz elgg-df535f87fbf6641bcadc2ffaa01846cad4cd9524.tar.bz2 |
not loading language files a second time when session initialized
-rw-r--r-- | engine/lib/languages.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/engine/lib/languages.php b/engine/lib/languages.php index 4dc094109..c6e2fc152 100644 --- a/engine/lib/languages.php +++ b/engine/lib/languages.php @@ -167,23 +167,33 @@ function register_translations($path, $load_all = false) { if ($CONFIG->system_cache_enabled && !$load_all) { // load language files from cache $data = array(); - $loaded = true; + $anything_loaded = false; + $missing_cache = false; foreach ($load_language_files as $lang_file) { $lang = substr($lang_file, 0, strpos($lang_file, '.')); - $data[$lang] = elgg_load_system_cache($lang_file); - if (!$data[$lang]) { - $loaded = false; - break; + // only load if this language isn't already loaded + if (!isset($CONFIG->translations) || !isset($CONFIG->translations[$lang])) { + $data[$lang] = elgg_load_system_cache($lang_file); + if (!$data[$lang]) { + $missing_cache = true; + break; + } else { + $anything_loaded = true; + } } } - if ($loaded) { + // did we load all requested languages from the cache + if (!$missing_cache && $anything_loaded) { foreach ($data as $lang => $map) { add_translation($lang, unserialize($map)); } $CONFIG->i18n_loaded_from_cache = true; return true; + } else if (!$missing_cache && !$anything_loaded) { + // everything previously loaded from cache + return true; } } |