function loadModuleLanguage($module, $lang, $refresh = false) { //here check if the cache file exists, if it does then load it, if it doesn't //then call refreshVardef //if either our session or the system is set to developerMode then refresh is set to true // Retrieve the vardefs from cache. $key = self::getLanguageCacheKey($module, $lang); if (!$refresh) { $return_result = sugar_cache_retrieve($key); if (!empty($return_result) && is_array($return_result)) { return $return_result; } } // Some of the vardefs do not correctly define dictionary as global. Declare it first. $cachedfile = sugar_cached('modules/') . $module . '/language/' . $lang . '.lang.php'; if ($refresh || !file_exists($cachedfile)) { LanguageManager::refreshLanguage($module, $lang); } //at this point we should have the cache/modules/... file //which was created from the refreshVardefs so let's try to load it. if (file_exists($cachedfile)) { global $mod_strings; require $cachedfile; // now that we hae loaded the data from disk, put it in the cache. if (!empty($mod_strings)) { sugar_cache_put($key, $mod_strings); } if (!empty($_SESSION['translation_mode'])) { $mod_strings = array_map('translated_prefix', $mod_strings); } return $mod_strings; } }