diff options
Diffstat (limited to 'engine/lib/languages.php')
-rw-r--r-- | engine/lib/languages.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/engine/lib/languages.php b/engine/lib/languages.php index 80c789ced..4dc094109 100644 --- a/engine/lib/languages.php +++ b/engine/lib/languages.php @@ -155,7 +155,6 @@ function register_translations($path, $load_all = false) { // Get the current language based on site defaults and user preference $current_language = get_current_language(); - elgg_log("Translations loaded from: $path"); // only load these files unless $load_all is true. $load_language_files = array( @@ -165,6 +164,29 @@ function register_translations($path, $load_all = false) { $load_language_files = array_unique($load_language_files); + if ($CONFIG->system_cache_enabled && !$load_all) { + // load language files from cache + $data = array(); + $loaded = true; + 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; + } + } + + if ($loaded) { + foreach ($data as $lang => $map) { + add_translation($lang, unserialize($map)); + } + + $CONFIG->i18n_loaded_from_cache = true; + return true; + } + } + $handle = opendir($path); if (!$handle) { elgg_log("Could not open language path: $path", 'ERROR'); @@ -186,6 +208,8 @@ function register_translations($path, $load_all = false) { } } + elgg_log("Translations loaded from: $path"); + return $return; } |