本文整理匯總了PHP中i18n::setCulture方法的典型用法代碼示例。如果您正苦於以下問題:PHP i18n::setCulture方法的具體用法?PHP i18n::setCulture怎麽用?PHP i18n::setCulture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類i18n
的用法示例。
在下文中一共展示了i18n::setCulture方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testPathWithStringI18N
public function testPathWithStringI18N()
{
i18n::setCulture('fr');
i18n::addDefinitions(array('url.myapp' => 'monapp', 'url.mycontroller' => 'moncontroller', 'url.myaction' => 'monaction'));
$this->assertEqual(UrlComponent::path('/myapp/mycontroller/myaction'), '/monapp/moncontroller/monaction');
$this->assertEqual(UrlComponent::path('mycontroller/myaction'), '/monapp/moncontroller/monaction');
$this->assertEqual(UrlComponent::path('/myapp/default/index'), '/monapp/default/index');
$this->assertEqual(UrlComponent::path('default/index'), '/monapp/default/index');
}
示例2: __construct
public function __construct()
{
$Dispatcher = Dispatcher::getInstance();
$Dispatcher->setApp('app');
$Dispatcher->setControllerName('myController');
$Dispatcher->setActionName('myAction');
i18n::setCulture('fr');
i18n::addDefinitions($this->def);
}
示例3: define
<?php
define('ROOT', realpath(dirname(__FILE__) . '/../../'));
define('LIB', ROOT . '/_lib');
define('APP', ROOT . '/apps' . dirname($_SERVER['SCRIPT_NAME']));
define('MODELS', ROOT . '/models');
define('CONTROLLERS', APP . '/controllers');
define('VIEWS', APP . '/views');
require_once LIB . '/core/_includes.php';
require_once LIB . '/vendors/doctrine/Doctrine.php';
require_once ROOT . '/configs/env.php';
require_once ROOT . '/configs/lang.php';
require_once ROOT . '/configs/set.php';
i18n::setCulture(LANG);
i18n::addDefinitionPath(APP . '/configs/i18n');
i18n::loadDefinitions();
$Bootstrap = Bootstrap::getInstance();
$Bootstrap->setDefaultPath('default/index');
$Bootstrap->setEnv(ENV);
$Bootstrap->addAutoloadPath(CONTROLLERS);
$Bootstrap->addAutoloadPath(CONTROLLERS . '/_components');
$Bootstrap->addAutoloadPath(VIEWS);
$Bootstrap->addAutoloadPath(VIEWS . '/_helpers');
$Bootstrap->loadConfigs(ROOT . '/configs');
$Bootstrap->loadConfigs(APP . '/configs');
$Bootstrap->addModelPath(MODELS . '/bases');
$Bootstrap->addModelPath(MODELS);
$Bootstrap->setDoctrine();
$Bootstrap->dispatch();