本文整理汇总了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();