本文整理汇总了PHP中LanguageManager::loadModuleLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::loadModuleLanguage方法的具体用法?PHP LanguageManager::loadModuleLanguage怎么用?PHP LanguageManager::loadModuleLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::loadModuleLanguage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: return_module_language
/**
* This function retrieves a module's language file and returns the array of strings included.
*
* @param string $language specific language to load
* @param string $module module name to load strings for
* @param bool $refresh optional, true if you want to rebuild the language strings
* @return array lang strings
*/
function return_module_language($language, $module, $refresh = false)
{
global $mod_strings;
global $sugar_config;
global $currentModule;
// Jenny - Bug 8119: Need to check if $module is not empty
if (empty($module)) {
$message = "Variable module is not in return_module_language ";
//If any object in the stack contains a circular reference,
//debug_backtrace will cause a fatal recursive dependency error without DEBUG_BACKTRACE_IGNORE_ARGS
if (version_compare(PHP_VERSION, '5.3.6') >= 0) {
$message .= var_export(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true);
}
$GLOBALS['log']->warn($message);
return array();
}
if (!$refresh) {
$cache_key = LanguageManager::getLanguageCacheKey($module, $language);
// Check for cached value
$cache_entry = sugar_cache_retrieve($cache_key);
if (!empty($cache_entry) && is_array($cache_entry)) {
return $cache_entry;
}
}
// Store the current mod strings for later
$temp_mod_strings = $mod_strings;
$loaded_mod_strings = array();
$language_used = $language;
$default_language = !empty($sugar_config['default_language']) ? $sugar_config['default_language'] : $language;
$bean = BeanFactory::getBean($module);
if (empty($language)) {
$language = $default_language;
}
// Bug 21559 - So we can get all the strings defined in the template, refresh
// the vardefs file if the cached language file doesn't exist.
if (!file_exists(sugar_cached('modules/') . $module . '/language/' . $language . '.lang.php') && !empty($GLOBALS['beanList'][$module])) {
$object = BeanFactory::getObjectName($module);
VardefManager::loadVardef($module, $object);
}
$loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language, $refresh);
// BR-24 & BR-25, some modules, like Dynamic Fields, don't have a module_dir and this throws a notice
if ($bean && !empty($bean->module_dir) && $bean->module_dir !== $module) {
$loaded_mod_strings = sugarLangArrayMerge(LanguageManager::loadModuleLanguage($bean->module_dir, $language, $refresh), $loaded_mod_strings);
}
// cn: bug 6048 - merge en_us with requested language
if ($language != $default_language) {
$loaded_mod_strings = sugarLangArrayMerge(LanguageManager::loadModuleLanguage($module, $default_language, $refresh), $loaded_mod_strings);
if ($bean && !empty($bean->module_dir) && $bean->module_dir !== $module) {
$loaded_mod_strings = sugarLangArrayMerge(LanguageManager::loadModuleLanguage($bean->module_dir, $default_language, $refresh), $loaded_mod_strings);
}
}
// Load in en_us strings by default
if ($language != 'en_us' && $default_language != 'en_us') {
$loaded_mod_strings = sugarLangArrayMerge(LanguageManager::loadModuleLanguage($module, 'en_us', $refresh), $loaded_mod_strings);
if ($bean && $bean->module_dir !== $module) {
$loaded_mod_strings = sugarLangArrayMerge(LanguageManager::loadModuleLanguage($bean->module_dir, 'en_us', $refresh), $loaded_mod_strings);
}
}
// If we are in debug mode for translating, turn on the prefix now!
if (!empty($sugar_config['translation_string_prefix']) && isset($loaded_mod_strings)) {
foreach ($loaded_mod_strings as $entry_key => $entry_value) {
$loaded_mod_strings[$entry_key] = $language_used . ' ' . $entry_value;
}
}
$return_value = $loaded_mod_strings;
if (!isset($mod_strings)) {
$mod_strings = $return_value;
} else {
$mod_strings = $temp_mod_strings;
}
$cache_key = LanguageManager::getLanguageCacheKey($module, $language);
sugar_cache_put($cache_key, $return_value);
return $return_value;
}
示例2: return_module_language
/**
* This function retrieves a module's language file and returns the array of strings included.
*
* @param string $language specific language to load
* @param string $module module name to load strings for
* @param bool $refresh optional, true if you want to rebuild the language strings
* @return array lang strings
*/
function return_module_language($language, $module, $refresh = false)
{
global $mod_strings;
global $sugar_config;
global $currentModule;
// Jenny - Bug 8119: Need to check if $module is not empty
if (empty($module)) {
$stack = debug_backtrace();
$GLOBALS['log']->warn("Variable module is not in return_module_language " . var_export($stack, true));
return array();
}
if (!$refresh) {
$cache_key = LanguageManager::getLanguageCacheKey($module, $language);
// Check for cached value
$cache_entry = sugar_cache_retrieve($cache_key);
if (!empty($cache_entry)) {
return $cache_entry;
}
}
// Store the current mod strings for later
$temp_mod_strings = $mod_strings;
$loaded_mod_strings = array();
$language_used = $language;
$default_language = $sugar_config['default_language'];
if (empty($language)) {
$language = $default_language;
}
// Bug 21559 - So we can get all the strings defined in the template, refresh
// the vardefs file if the cached language file doesn't exist.
if (!file_exists($GLOBALS['sugar_config']['cache_dir'] . 'modules/' . $module . '/language/' . $language . '.lang.php') && !empty($GLOBALS['beanList'][$module])) {
$object = $GLOBALS['beanList'][$module];
if ($object == 'aCase') {
$object = 'Case';
}
VardefManager::refreshVardefs($module, $object);
}
$loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language, $refresh);
// cn: bug 6048 - merge en_us with requested language
if ($language != $sugar_config['default_language']) {
$loaded_mod_strings = sugarArrayMerge(LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'], $refresh), $loaded_mod_strings);
}
// Load in en_us strings by default
if ($language != 'en_us' && $sugar_config['default_language'] != 'en_us') {
$loaded_mod_strings = sugarArrayMerge(LanguageManager::loadModuleLanguage($module, 'en_us', $refresh), $loaded_mod_strings);
}
// If we are in debug mode for translating, turn on the prefix now!
if ($sugar_config['translation_string_prefix']) {
foreach ($loaded_mod_strings as $entry_key => $entry_value) {
$loaded_mod_strings[$entry_key] = $language_used . ' ' . $entry_value;
}
}
$return_value = $loaded_mod_strings;
if (!isset($mod_strings)) {
$mod_strings = $return_value;
} else {
$mod_strings = $temp_mod_strings;
}
$cache_key = LanguageManager::getLanguageCacheKey($module, $language);
sugar_cache_put($cache_key, $return_value);
return $return_value;
}
示例3: removeFileFromPath
removeFileFromPath('footer.php', 'themes', $deleteNot);
logThis('End removing footer.php file from themes...');
}
//}
}
require 'modules/UpgradeWizard/' . $upgradeStepFile . '.php';
$afterCurrentStep = $_REQUEST['step'] + 1;
//// END LOGIC
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// UPGRADE HISTORY
// Reload language strings after copy
if (empty($GLOBALS['current_language'])) {
$GLOBALS['current_language'] = 'en_us';
}
LanguageManager::loadModuleLanguage('UpgradeWizard', $GLOBALS['current_language'], true);
// display installed pieces and versions
$installeds = $uh->getAll();
$upgrades_installed = 0;
$uwHistory = '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view"><tr><td>' . $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'] . "<br>\n";
$uwHistory .= "<ul>\n";
$uwHistory .= "<table class=\"edit view\" cellspacing=5>\n";
$uwHistory .= <<<eoq
\t<tr>
\t\t<td></td>
\t\t<td align=left>
\t\t\t<b>{$mod_strings['LBL_ML_NAME']}</b>
\t\t</td>
\t\t<td align=left>
\t\t\t<b>{$mod_strings['LBL_ML_TYPE']}</b>
\t\t</td>