当前位置: 首页>>代码示例>>PHP>>正文


PHP LanguageManager::loadTemplateLanguage方法代码示例

本文整理汇总了PHP中LanguageManager::loadTemplateLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::loadTemplateLanguage方法的具体用法?PHP LanguageManager::loadTemplateLanguage怎么用?PHP LanguageManager::loadTemplateLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LanguageManager的用法示例。


在下文中一共展示了LanguageManager::loadTemplateLanguage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: refreshLanguage

 /**
  * Given a module, search all of the specified locations, and any others as specified
  * in order to refresh the cache file
  *
  * @param string $module the given module we want to load the vardefs for
  * @param string $lang the given language we wish to load
  * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search
  */
 function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null)
 {
     // Some of the vardefs do not correctly define dictionary as global.  Declare it first.
     $lang_paths = array('modules/' . $module . '/language/' . $lang . '.lang.php', 'modules/' . $module . '/language/' . $lang . '.lang.override.php', 'custom/modules/' . $module . '/Ext/Language/' . $lang . '.lang.ext.php', 'custom/modules/' . $module . '/language/' . $lang . '.lang.php');
     #27023, if this module template language file was not attached , get the template from this module vardef cache file if exsits and load the template language files.
     static $createdModules;
     if (empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])) {
         $object = $GLOBALS['beanList'][$module];
         if ($object == 'aCase') {
             $object = 'Case';
         }
         if (!empty($GLOBALS["dictionary"]["{$object}"]["templates"])) {
             $templates = $GLOBALS["dictionary"]["{$object}"]["templates"];
             $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module, $templates, $lang, $loaded_mod_strings);
             $createdModules[$module] = true;
         }
     }
     //end of fix #27023
     // Add in additional search paths if they were provided.
     if (!empty($additional_search_paths) && is_array($additional_search_paths)) {
         $lang_paths = array_merge($lang_paths, $additional_search_paths);
     }
     //search a predefined set of locations for the vardef files
     foreach ($lang_paths as $path) {
         if (file_exists($path)) {
             require $path;
             if (!empty($mod_strings)) {
                 if (function_exists('sugarArrayMergeRecursive')) {
                     $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings);
                 } else {
                     $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings);
                 }
             }
         }
     }
     //great! now that we have loaded all of our vardefs.
     //let's go save them to the cache file.
     if (!empty($loaded_mod_strings)) {
         LanguageManager::saveCache($module, $lang, $loaded_mod_strings);
     }
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:49,代码来源:LanguageManager.php

示例2: refreshLanguage

 /**
  * Given a module, search all of the specified locations, and any others as specified
  * in order to refresh the cache file
  *
  * @param string $module the given module we want to load the vardefs for
  * @param string $lang the given language we wish to load
  * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search
  */
 public static function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null)
 {
     // Some of the vardefs do not correctly define dictionary as global.  Declare it first.
     $lang_paths = self::getModuleLanguageFilePaths($module, $lang);
     $object = BeanFactory::getObjectName($module);
     if ($object && !empty($GLOBALS['dictionary'][$object]['templates'])) {
         $templates = $GLOBALS['dictionary'][$object]['templates'];
         $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module, $templates, $lang, $loaded_mod_strings);
     }
     // Add in additional search paths if they were provided.
     if (!empty($additional_search_paths) && is_array($additional_search_paths)) {
         $lang_paths = array_merge($lang_paths, $additional_search_paths);
     }
     //search a predefined set of locations for the vardef files
     foreach (SugarAutoLoader::existing($lang_paths) as $path) {
         require $path;
         if (!empty($mod_strings)) {
             if (function_exists('sugarArrayMergeRecursive')) {
                 $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings);
             } else {
                 $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings);
             }
         }
     }
     //great! now that we have loaded all of our vardefs.
     //let's go save them to the cache file.
     if (!empty($loaded_mod_strings)) {
         LanguageManager::saveCache($module, $lang, $loaded_mod_strings);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:38,代码来源:LanguageManager.php


注:本文中的LanguageManager::loadTemplateLanguage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。