當前位置: 首頁>>代碼示例>>PHP>>正文


PHP I18n::factory方法代碼示例

本文整理匯總了PHP中I18n::factory方法的典型用法代碼示例。如果您正苦於以下問題:PHP I18n::factory方法的具體用法?PHP I18n::factory怎麽用?PHP I18n::factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在I18n的用法示例。


在下文中一共展示了I18n::factory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: loadDefaultLibs

 /**
  * Loads the default most commonly used libraries for the framework
  *
  * @return object
  */
 public function loadDefaultLibs()
 {
     $config = Registry::get('config');
     foreach ($this->defaultLibs as $library) {
         if ($library == 'cache') {
             try {
                 $cache = Cache::factory($config->get('cache/type'));
             } catch (Config_KeyNoExist $e) {
                 // Revert to file based caching.
                 $cache = Cache::factory('file');
             }
             try {
                 $cache->ttl($config->get('cache/ttl'));
             } catch (Exception $e) {
             }
         } else {
             if ($library == 'i18n') {
                 try {
                     I18n::factory($config->get('locale/engine'));
                 } catch (Config_KeyNoExist $e) {
                     I18n::factory('failsafe');
                 }
             } else {
                 $this->loadLib($library);
             }
         }
     }
     return $this;
 }
開發者ID:jinshana,項目名稱:tangocms,代碼行數:34,代碼來源:zula.php

示例2: sprintf

<?php

/**
 * Zula Framework setup specific
 * Does specific tasks that may be needed, such as adding new config values that previous
 * versions of Zula may not have had (If you are upgrading, for example).
 *
 * @patches submit all patches to patches@tangocms.org
 *
 * @author Alex Cartwright
 * @author Robert Clipsham
 * @copyright Copyright (C) 2007, 2008, 2009, 2010 Alex Cartwright
 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU/LGPL 2.1
 * @package Zula_Install
 */
Registry::get('cache')->purge();
Registry::unregister('cache');
Cache::factory('disabled');
I18n::factory('gettext_php');
$config->update('config/title', sprintf(t('%s %s setup'), _PROJECT_NAME, _PROJECT_LATEST_VERSION));
$config->update('acl/enable', 0);
開發者ID:jinshana,項目名稱:tangocms,代碼行數:21,代碼來源:setup.php


注:本文中的I18n::factory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。