Пример #1
0
 function it_format_datetime_diff_for_specific_locale(Difference $diff)
 {
     $diff->getUnit()->willReturn(new Minute());
     $diff->getQuantity()->willReturn(10);
     $diff->isPast()->willReturn(true);
     $this->formatDifference($diff, 'pl')->shouldReturn('10 minut temu');
 }
Пример #2
0
 /**
  * @param Difference $difference
  * @param string     $locale
  *
  * @return string
  */
 public function formatDifference(Difference $difference, $locale = 'en')
 {
     $translationKey = sprintf('%s.%s', $difference->getUnit()->getName(), $difference->isPast() ? 'past' : 'future');
     return $this->translator->transChoice($translationKey, $difference->getQuantity(), array('%count%' => $difference->getQuantity()), 'difference', $locale);
 }