本文整理汇总了PHP中OCP\IL10N::n方法的典型用法代码示例。如果您正苦于以下问题:PHP IL10N::n方法的具体用法?PHP IL10N::n怎么用?PHP IL10N::n使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\IL10N
的用法示例。
在下文中一共展示了IL10N::n方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: joinParameterList
/**
* Returns a list of grouped parameters
*
* 2 parameters are joined by "and":
* => A and B
* Up to 5 parameters are joined by "," and "and":
* => A, B, C, D and E
* More than 5 parameters are joined by "," and trimmed:
* => A, B, C and #n more
*
* @param array $parameterList
* @param array $plainParameterList
* @param bool $highlightParams
* @return string
*/
protected function joinParameterList($parameterList, $plainParameterList, $highlightParams)
{
if (empty($parameterList)) {
return '';
}
$count = sizeof($parameterList);
$lastItem = array_pop($parameterList);
if ($count === 1) {
return $lastItem;
} else {
if ($count === 2) {
$firstItem = array_pop($parameterList);
return $this->l->t('%s and %s', array($firstItem, $lastItem));
} else {
if ($count <= 5) {
$list = implode($this->l->t(', '), $parameterList);
return $this->l->t('%s and %s', array($list, $lastItem));
}
}
}
$firstParams = array_slice($parameterList, 0, 3);
$firstList = implode($this->l->t(', '), $firstParams);
$trimmedParams = array_slice($plainParameterList, 3);
$trimmedList = implode($this->l->t(', '), $trimmedParams);
if ($highlightParams) {
return $this->l->n('%s and <strong %s>%n more</strong>', '%s and <strong %s>%n more</strong>', $count - 3, array($firstList, 'class="has-tooltip" title="' . Util::sanitizeHTML($trimmedList) . '"'));
}
return $this->l->n('%s and %n more', '%s and %n more', $count - 3, array($firstList));
}
示例2: countUsers
/**
* @return WizardResult
* @throws \Exception
*/
public function countUsers()
{
$filter = $this->access->getFilterForUserCount();
$usersTotal = $this->formatCountResult($this->countEntries($filter, 'users'));
$output = self::$l->n('%s user found', '%s users found', $usersTotal, array($usersTotal));
$this->result->addChange('ldap_user_count', $output);
return $this->result;
}