public function loadTranslations($language = null)
{
if (elgg_is_system_cache_enabled()) {
$loaded = true;
if ($language) {
$languages = array($language);
} else {
$languages = array_unique(array('en', $this->getCurrentLanguage()));
}
foreach ($languages as $language) {
$data = elgg_load_system_cache("{$language}.lang");
if ($data) {
$this->addTranslation($language, unserialize($data));
} else {
$loaded = false;
}
}
if ($loaded) {
$GLOBALS['_ELGG']->i18n_loaded_from_cache = true;
// this is here to force
$GLOBALS['_ELGG']->language_paths[$this->defaultPath] = true;
return;
}
}
// load core translations from languages directory
$this->registerTranslations($this->defaultPath, false, $language);
// Plugin translation have already been loaded for the default
// languages by ElggApplication::bootCore(), so there's no need
// to continue unless loading a specific language on-demand
if ($language) {
$this->loadPluginTranslations($language);
}
}