本文整理汇总了PHP中__dcn函数的典型用法代码示例。如果您正苦于以下问题:PHP __dcn函数的具体用法?PHP __dcn怎么用?PHP __dcn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了__dcn函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test__dcn
/**
* test __dcn()
*
* @access public
* @return void
*/
function test__dcn()
{
Configure::write('Config.language', 'rule_1_po');
$result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, 6, true);
$expected = '%d = 0 or > 1 (translated)';
$this->assertEqual($result, $expected);
$result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6, true);
$expected = '%d = 1 (from core translated)';
$this->assertEqual($result, $expected);
$result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, 6, true);
$expected = '%d = 0 or > 1';
$this->assertEqual($result, $expected);
ob_start();
__dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6);
$result = ob_get_clean();
$expected = '%d = 1 (from core translated)';
$this->assertEqual($result, $expected);
}
示例2: testTranslateDomainCategoryPlural
/**
* test __dcn()
*
* @return void
*/
public function testTranslateDomainCategoryPlural()
{
Configure::write('Config.language', 'rule_1_po');
$result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, 6);
$expected = '%d = 0 or > 1 (translated)';
$this->assertEquals($expected, $result);
$result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6);
$expected = '%d = 1 (from core translated)';
$this->assertEquals($expected, $result);
$result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, 6);
$expected = '%d = 0 or > 1';
$this->assertEquals($expected, $result);
$result = __dcn('core', '%d item.', '%d items.', 1, 6, 1);
$expected = '1 item.';
$this->assertEquals($expected, $result);
$result = __dcn('core', '%d item for id %s', '%d items for id %s', 2, 6, 2, '1234');
$expected = '2 items for id 1234';
$this->assertEquals($expected, $result);
$result = __dcn('core', '%d item for id %s', '%d items for id %s', 2, 6, array(2, '1234'));
$expected = '2 items for id 1234';
$this->assertEquals($expected, $result);
}
示例3: _domainCategoryPlural
/**
* Plural method
*
* @return void
*/
protected function _domainCategoryPlural($domain = 'test_plugin', $category = 3)
{
$plurals = array();
for ($number = 0; $number <= 25; $number++) {
$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (double) $number, $category), (double) $number);
}
return $plurals;
}
示例4: __
/**
* Only used when -debug option
*/
return null;
$singularReturn = __('Singular string return __()', true);
$singularEcho = __('Singular string echo __()');
$pluralReturn = __n('% apple in the bowl (plural string return __n())', '% apples in the blowl (plural string 2 return __n())', 3, true);
$pluralEcho = __n('% apple in the bowl (plural string 2 echo __n())', '% apples in the blowl (plural string 2 echo __n()', 3);
$singularDomainReturn = __d('controllers', 'Singular string domain lookup return __d()', true);
$singularDomainEcho = __d('controllers', 'Singular string domain lookup echo __d()');
$pluralDomainReturn = __dn('controllers', '% pears in the bowl (plural string domain lookup return __dn())', '% pears in the blowl (plural string domain lookup return __dn())', 3, true);
$pluralDomainEcho = __dn('controllers', '% pears in the bowl (plural string domain lookup echo __dn())', '% pears in the blowl (plural string domain lookup echo __dn())', 3);
$singularDomainCategoryReturn = __dc('controllers', 'Singular string domain and category lookup return __dc()', 5, true);
$singularDomainCategoryEcho = __dc('controllers', 'Singular string domain and category lookup echo __dc()', 5);
$pluralDomainCategoryReturn = __dcn('controllers', '% apple in the bowl (plural string 1 domain and category lookup return __dcn())', '% apples in the blowl (plural string 2 domain and category lookup return __dcn())', 3, 5, true);
$pluralDomainCategoryEcho = __dcn('controllers', '% apple in the bowl (plural string 1 domain and category lookup echo __dcn())', '% apples in the blowl (plural string 2 domain and category lookup echo __dcn())', 3, 5);
$categoryReturn = __c('Category string lookup line return __c()', 5, true);
$categoryEcho = __c('Category string lookup line echo __c()', 5);
/**
* Language string extractor
*
* @package cake
* @subpackage cake.cake.console.libs
*/
class ExtractShell extends Shell
{
var $path = null;
var $files = array();
var $__filename = 'default';
var $__oneFile = true;
var $__file = null;