本文整理汇总了PHP中LanguageManager::refreshLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::refreshLanguage方法的具体用法?PHP LanguageManager::refreshLanguage怎么用?PHP LanguageManager::refreshLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::refreshLanguage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadModuleLanguage
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;
}
}