当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_L10N::n方法代码示例

本文整理汇总了PHP中OC_L10N::n方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_L10N::n方法的具体用法?PHP OC_L10N::n怎么用?PHP OC_L10N::n使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_L10N的用法示例。


在下文中一共展示了OC_L10N::n方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formatDateSpanData

 public function formatDateSpanData()
 {
     $time = 1416916800;
     // Use a fixed timestamp so we don't switch days/years with the getTimestampAgo
     $deL10N = new \OC_L10N('lib', 'de');
     return array(array('today', $this->getTimestampAgo($time, 30, 15), $time), array('yesterday', $this->getTimestampAgo($time, 0, 0, 0, 1), $time), array('4 days ago', $this->getTimestampAgo($time, 0, 0, 0, 4), $time), array('5 months ago', $this->getTimestampAgo($time, 0, 0, 0, 155), $time), array('2 years ago', $this->getTimestampAgo($time, 0, 0, 0, 0, 2), $time), array('today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('yesterday', $this->getTimestampAgo($time, 30, 15, 3, 1, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('5 months ago', $this->getTimestampAgo($time, 30, 15, 3, 155, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('2 years ago', $this->getTimestampAgo($time, 30, 15, 3, 35, 3), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array($deL10N->t('today'), new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), array($deL10N->t('yesterday'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N), array($deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N), array($deL10N->n('%n month ago', '%n months ago', 9), new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N), array($deL10N->n('%n year ago', '%n years ago', 2), new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N), array('today', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('today', new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('today', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), array('yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), array('yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('yesterday', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')), array('yesterday', new \DateTime('Mon, 31 Dec 2012 00:00:00 +0000'), new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000')), array('2 days ago', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), array('last month', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 31 Oct 2013 00:00:00 +0000')), array('last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')), array('last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Thu, 31 Oct 2013 00:00:00 +0000')), array('9 months ago', new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), array('11 months ago', new \DateTime('Thu, 03 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), array('last year', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), array('last year', new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), array('2 years ago', new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')));
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:7,代码来源:datetimeformatter.php

示例2: testCzechPluralTranslations

 public function testCzechPluralTranslations()
 {
     $l = new OC_L10N('test');
     $transFile = OC::$SERVERROOT . '/tests/data/l10n/cs.json';
     $l->load($transFile);
     $this->assertEquals('1 okno', (string) $l->n('%n window', '%n windows', 1));
     $this->assertEquals('2 okna', (string) $l->n('%n window', '%n windows', 2));
     $this->assertEquals('5 oken', (string) $l->n('%n window', '%n windows', 5));
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:9,代码来源:l10n.php

示例3: 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 class="tooltip" title="%s">%n more</strong>', '%s and <strong class="tooltip" title="%s">%n more</strong>', $count - 3, array($firstList, $trimmedList));
     }
     return $this->l->n('%s and %n more', '%s and %n more', $count - 3, array($firstList));
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:44,代码来源:parameterhelper.php


注:本文中的OC_L10N::n方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。