├── src └── Coduo │ └── PHPHumanizer │ ├── Resources │ ├── translations │ │ ├── oxford.sv.php │ │ ├── oxford.ja.php │ │ ├── oxford.ru.php │ │ ├── oxford.uk.php │ │ ├── oxford.zh_CN.php │ │ ├── oxford.zh_TW.php │ │ ├── oxford.es.php │ │ ├── oxford.pl.php │ │ ├── oxford.fr.php │ │ ├── oxford.it.php │ │ ├── oxford.ro.php │ │ ├── oxford.th.php │ │ ├── oxford.da.php │ │ ├── oxford.nl.php │ │ ├── oxford.cs.php │ │ ├── oxford.en.php │ │ ├── oxford.id.php │ │ ├── oxford.sk.php │ │ ├── difference.zh_CN.php │ │ ├── difference.zh_TW.php │ │ ├── difference.th.php │ │ ├── difference.ja.php │ │ ├── difference.tr.php │ │ ├── difference.az.php │ │ ├── difference.de.php │ │ ├── difference.da.php │ │ ├── difference.bg.php │ │ ├── difference.no.php │ │ ├── difference.en.php │ │ ├── difference.nl.php │ │ ├── difference.it.php │ │ ├── difference.ro.php │ │ ├── difference.es.php │ │ ├── difference.af.php │ │ ├── difference.ru.php │ │ ├── difference.uk.php │ │ ├── difference.sv.php │ │ ├── difference.id.php │ │ ├── difference.pt.php │ │ ├── difference.cs.php │ │ ├── difference.pt_BR.php │ │ ├── difference.sk.php │ │ ├── difference.fr.php │ │ └── difference.pl.php │ └── Ordinal │ │ ├── DeStrategy.php │ │ ├── EsStrategy.php │ │ ├── IdStrategy.php │ │ ├── ItStrategy.php │ │ ├── NlStrategy.php │ │ ├── PtStrategy.php │ │ ├── FrStrategy.php │ │ └── EnStrategy.php │ ├── String │ ├── TruncateInterface.php │ ├── Breakpoint.php │ ├── WordBreakpoint.php │ ├── TextTruncate.php │ ├── Humanize.php │ ├── ShortcodeProcessor.php │ ├── MetricSuffix.php │ ├── HtmlTruncate.php │ └── BinarySuffix.php │ ├── Number │ ├── Ordinal │ │ ├── StrategyInterface.php │ │ └── Builder.php │ ├── Ordinal.php │ └── RomanNumeral.php │ ├── DateTime │ ├── Unit.php │ ├── Unit │ │ ├── Second.php │ │ ├── Day.php │ │ ├── Month.php │ │ ├── Year.php │ │ ├── Hour.php │ │ ├── Minute.php │ │ ├── JustNow.php │ │ └── Week.php │ ├── Difference │ │ └── CompoundResult.php │ ├── Formatter.php │ ├── PreciseDifference.php │ ├── DateIntervalCompound.php │ ├── PreciseFormatter.php │ └── Difference.php │ ├── Collection │ ├── Oxford.php │ └── Formatter.php │ ├── CollectionHumanizer.php │ ├── Aeon │ └── Calendar │ │ ├── Formatter.php │ │ └── UnitCompound.php │ ├── Translator │ └── Builder.php │ ├── DateTimeHumanizer.php │ ├── StringHumanizer.php │ └── NumberHumanizer.php ├── UPGRADE.md ├── phpunit.xml.dist ├── LICENSE ├── composer.json ├── CODE_OF_CONDUCT.md ├── README.md └── CHANGELOG.md /src/Coduo/PHPHumanizer/Resources/translations/oxford.sv.php: -------------------------------------------------------------------------------- 1 | '%first% och %second%', 5 | 'comma_separated' => '%list%, och %last%', 6 | 'comma_separated_with_limit' => '[1,Inf] %list%, och %count% till', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.ja.php: -------------------------------------------------------------------------------- 1 | '%first% と %second%', 5 | 'comma_separated' => '%list% と %last%', 6 | 'comma_separated_with_limit' => '{1} %list% ともうひとり|[2,Inf] %list% ともう %count% 人', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.ru.php: -------------------------------------------------------------------------------- 1 | '%first% и %second%', 5 | 'comma_separated' => '%list% и %last%', 6 | 'comma_separated_with_limit' => '{1} %list% и ещё 1|[2,Inf] %list% и ещё %count%', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.uk.php: -------------------------------------------------------------------------------- 1 | '%first% та %second%', 5 | 'comma_separated' => '%list% та %last%', 6 | 'comma_separated_with_limit' => '{1} %list% і ще 1|[2,Inf] %list% і ще %count%', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.zh_CN.php: -------------------------------------------------------------------------------- 1 | '%first% 和 %second%', 5 | 'comma_separated' => '%list%, 和 %last%', 6 | 'comma_separated_with_limit' => '{1} %list% 和另一个|[2,Inf] %list% 和另 %count% 个', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.zh_TW.php: -------------------------------------------------------------------------------- 1 | '%first% 和 %second%', 5 | 'comma_separated' => '%list%, 和 %last%', 6 | 'comma_separated_with_limit' => '{1} %list% 和另一個|[2,Inf] %list% 和另 %count% 個', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.es.php: -------------------------------------------------------------------------------- 1 | '%first% y %second%', 5 | 'comma_separated' => '%list%, y %last%', 6 | 'comma_separated_with_limit' => '{1} %list%, y 1 más|[2,Inf] %list%, y %count% más', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.pl.php: -------------------------------------------------------------------------------- 1 | '%first% i %second%', 5 | 'comma_separated' => '%list% i %last%', 6 | 'comma_separated_with_limit' => '{1} %list% i 1 inny|[2,Inf] %list% i %count% innych', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.fr.php: -------------------------------------------------------------------------------- 1 | '%first% et %second%', 5 | 'comma_separated' => '%list% et %last%', 6 | 'comma_separated_with_limit' => '{1} %list% et 1 autre|[2,Inf] %list% et %count% autres', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.it.php: -------------------------------------------------------------------------------- 1 | '%first% e %second%', 5 | 'comma_separated' => '%list% e %last%', 6 | 'comma_separated_with_limit' => '{1} %list% ed un altro|[2,Inf] %list% e %count% altri', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.ro.php: -------------------------------------------------------------------------------- 1 | '%first% și %second%', 5 | 'comma_separated' => '%list% și %last%', 6 | 'comma_separated_with_limit' => '{1} %list% și încă unul|[2,Inf] %list% și %count% alții', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.th.php: -------------------------------------------------------------------------------- 1 | '%first% และ %second%', 5 | 'comma_separated' => '%list% และ %last%', 6 | 'comma_separated_with_limit' => '{1} %list% และอีก 1|[2,Inf] %list% และอีก %count%', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.da.php: -------------------------------------------------------------------------------- 1 | '%first% og %second%', 5 | 'comma_separated' => '%list%, og %last%', 6 | 'comma_separated_with_limit' => '{1} %list%, og 1 anden|[2,Inf] %list%, og %count% andre', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.nl.php: -------------------------------------------------------------------------------- 1 | '%first% en %second%', 5 | 'comma_separated' => '%list%, en %last%', 6 | 'comma_separated_with_limit' => '{1} %list%, en 1 andere|[2,Inf] %list%, en %count% andere', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.cs.php: -------------------------------------------------------------------------------- 1 | '%first% a %second%', 5 | 'comma_separated' => '%list%, a %last%', 6 | 'comma_separated_with_limit' => '[1,4] %list%, a %count% další|[5,Inf] %list%, a %count% dalších', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.en.php: -------------------------------------------------------------------------------- 1 | '%first% and %second%', 5 | 'comma_separated' => '%list%, and %last%', 6 | 'comma_separated_with_limit' => '{1} %list%, and 1 other|[2,Inf] %list%, and %count% others', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.id.php: -------------------------------------------------------------------------------- 1 | '%first% dan %second%', 5 | 'comma_separated' => '%list%, dan %last%', 6 | 'comma_separated_with_limit' => '{1} %list%, dan 1 lainnya|[2,Inf] %list%, dan %count% lainnya', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/oxford.sk.php: -------------------------------------------------------------------------------- 1 | '%first% a %second%', 5 | 'comma_separated' => '%list%, a %last%', 6 | 'comma_separated_with_limit' => '[1,4] %list%, a %count% ďalší|[5,Inf] %list%, a %count% ďalších', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/String/TruncateInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/ 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ./src/ 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Collection/Oxford.php: -------------------------------------------------------------------------------- 1 | formatter = $formatter; 21 | } 22 | 23 | /** 24 | * @param array $collection 25 | */ 26 | public function format(array $collection, ?int $limit = null) : string 27 | { 28 | return $this->formatter->format($collection, $limit); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/Unit/Day.php: -------------------------------------------------------------------------------- 1 | getMilliseconds() * 24; 28 | } 29 | 30 | public function getDateIntervalSymbol() : string 31 | { 32 | return 'd'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/Unit/Month.php: -------------------------------------------------------------------------------- 1 | getMilliseconds() * 30; 28 | } 29 | 30 | public function getDateIntervalSymbol() : string 31 | { 32 | return 'm'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/Unit/Year.php: -------------------------------------------------------------------------------- 1 | getMilliseconds() * 356; 28 | } 29 | 30 | public function getDateIntervalSymbol() : string 31 | { 32 | return 'y'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/Unit/Hour.php: -------------------------------------------------------------------------------- 1 | getMilliseconds() * 60; 28 | } 29 | 30 | public function getDateIntervalSymbol() : string 31 | { 32 | return 'h'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/Unit/Minute.php: -------------------------------------------------------------------------------- 1 | getMilliseconds() * 60; 28 | } 29 | 30 | public function getDateIntervalSymbol() : string 31 | { 32 | return 'i'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/Unit/JustNow.php: -------------------------------------------------------------------------------- 1 | getMilliseconds() * 7; 28 | } 29 | 30 | public function getDateIntervalSymbol() : string 31 | { 32 | throw new \RuntimeException("Week doesn't have date interval symbol equivalent"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/CollectionHumanizer.php: -------------------------------------------------------------------------------- 1 | $collection 22 | */ 23 | public static function oxford(array $collection, ?int $limit = null, string $locale = 'en') : string 24 | { 25 | $oxford = new Oxford( 26 | new Formatter(Builder::build($locale)) 27 | ); 28 | 29 | return $oxford->format($collection, $limit); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/String/WordBreakpoint.php: -------------------------------------------------------------------------------- 1 | \mb_strlen($text)) { 23 | return \mb_strlen($text); 24 | } 25 | 26 | $breakpoint = \mb_strpos($text, ' ', $charactersCount); 27 | 28 | if (false === $breakpoint) { 29 | return \mb_strlen($text); 30 | } 31 | 32 | return $breakpoint; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/Difference/CompoundResult.php: -------------------------------------------------------------------------------- 1 | unit = $unit; 31 | $this->quantity = $quantity; 32 | } 33 | 34 | /** 35 | * @return float|int 36 | */ 37 | public function getQuantity() 38 | { 39 | return $this->quantity; 40 | } 41 | 42 | public function getUnit() : Unit 43 | { 44 | return $this->unit; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/Ordinal/EnStrategy.php: -------------------------------------------------------------------------------- 1 | translator = $translator; 23 | } 24 | 25 | public function formatDifference(Difference $difference, string $locale = 'en') : string 26 | { 27 | $translationKey = \sprintf('%s.%s', $difference->getUnit()->getName(), $difference->isPast() ? 'past' : 'future'); 28 | 29 | return $this->translator->trans( 30 | $translationKey, 31 | ['%count%' => $difference->getQuantity()], 32 | 'difference', 33 | $locale 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/String/TextTruncate.php: -------------------------------------------------------------------------------- 1 | breakpoint = $breakpoint; 23 | $this->append = $append; 24 | } 25 | 26 | public function truncate(string $text, int $charactersCount) : string 27 | { 28 | if ($charactersCount < 0 || \mb_strlen($text) <= $charactersCount) { 29 | return $text; 30 | } 31 | 32 | $truncatedText = \rtrim(\mb_substr($text, 0, $this->breakpoint->calculatePosition($text, $charactersCount))); 33 | 34 | return ($truncatedText === $text) ? $truncatedText : $truncatedText . $this->append; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2021 Michal Dabrowski, Norbert Orzechowicz 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Number/Ordinal.php: -------------------------------------------------------------------------------- 1 | number = $number; 33 | $this->strategy = Builder::build($locale); 34 | } 35 | 36 | public function __toString() : string 37 | { 38 | return $this 39 | ->strategy 40 | ->ordinalIndicator($this->number); 41 | } 42 | 43 | public function isPrefix() : bool 44 | { 45 | return $this->strategy->isPrefix(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/String/Humanize.php: -------------------------------------------------------------------------------- 1 | 24 | */ 25 | private array $forbiddenWords; 26 | 27 | /** 28 | * @param array $forbiddenWords 29 | */ 30 | public function __construct(string $text, bool $capitalize = true, string $separator = '_', array $forbiddenWords = ['id']) 31 | { 32 | $this->text = $text; 33 | $this->capitalize = $capitalize; 34 | $this->separator = $separator; 35 | $this->forbiddenWords = $forbiddenWords; 36 | } 37 | 38 | public function __toString() : string 39 | { 40 | $humanized = \trim(\strtolower((string) \preg_replace(['/([A-Z])/', \sprintf('/[%s\s]+/', $this->separator)], ['_$1', ' '], $this->text))); 41 | $humanized = \trim(\str_replace($this->forbiddenWords, '', $humanized)); 42 | 43 | return $this->capitalize ? \ucfirst($humanized) : $humanized; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/PreciseDifference.php: -------------------------------------------------------------------------------- 1 | fromDate = $fromDate; 27 | $this->toDate = $toDate; 28 | $this->compoundResults = null; 29 | } 30 | 31 | /** 32 | * @return array 33 | */ 34 | public function components() : array 35 | { 36 | if ($this->compoundResults === null) { 37 | $this->compoundResults = new DateIntervalCompound($this->fromDate->diff($this->toDate)); 38 | } 39 | 40 | return $this->compoundResults->components(); 41 | } 42 | 43 | public function isPast() : bool 44 | { 45 | $diff = $this->toDate->getTimestamp() - $this->fromDate->getTimestamp(); 46 | 47 | return ($diff > 0) ? false : true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Aeon/Calendar/Formatter.php: -------------------------------------------------------------------------------- 1 | translator = $translator; 25 | } 26 | 27 | public function timeUnit(Unit $unit, string $locale = 'en') : string 28 | { 29 | if (!\interface_exists('\Aeon\Calendar\Gregorian\Calendar')) { 30 | throw new \RuntimeException('Please add "aeon-php/calendar": ^1.0 to composer.json first'); 31 | } 32 | 33 | $parts = []; 34 | 35 | foreach ((new UnitCompound($unit))->components() as $component) { 36 | $parts[] = $this->translator->trans( 37 | 'compound.' . $component->getUnit()->getName(), 38 | ['%count%' => $component->getQuantity()], 39 | 'difference', 40 | $locale 41 | ); 42 | } 43 | 44 | return CollectionHumanizer::oxford($parts, null, $locale); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.zh_CN.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] 刚刚', 6 | 'future' => '[0,Inf] 刚刚', 7 | ], 8 | 'second' => [ 9 | 'past' => '[1,Inf] %count% 秒前', 10 | 'future' => '[1,Inf] %count% 秒后', 11 | ], 12 | 'minute' => [ 13 | 'past' => '[1,Inf] %count% 分钟前', 14 | 'future' => '[1,Inf] %count% 分钟后', 15 | ], 16 | 'hour' => [ 17 | 'past' => '[1,Inf] %count% 小时前', 18 | 'future' => '[1,Inf] %count% 小时后', 19 | ], 20 | 'day' => [ 21 | 'past' => '[1,Inf] %count% 天前', 22 | 'future' => '[1,Inf] %count% 天后', 23 | ], 24 | 'week' => [ 25 | 'past' => '[1,Inf] %count% 周前', 26 | 'future' => '[1,Inf] %count% 周后', 27 | ], 28 | 'month' => [ 29 | 'past' => '[1,Inf] %count% 个月前', 30 | 'future' => '[1,Inf] %count% 个月后', 31 | ], 32 | 'year' => [ 33 | 'past' => '[1,Inf] %count% 年前', 34 | 'future' => '[1,Inf] %count% 年后', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,Inf] %count% 秒', 38 | 'minute' => '[1,Inf] %count% 分钟', 39 | 'hour' => '[1,Inf] %count% 小时', 40 | 'day' => '[1,Inf] %count% 天', 41 | 'week' => '[1,Inf] %count% 周', 42 | 'month' => '[1,Inf] %count% 个月', 43 | 'year' => '[1,Inf] %count% 年', 44 | 'past' => '%value%前', 45 | 'future' => '%value%后', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.zh_TW.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] 剛剛', 6 | 'future' => '[0,Inf] 剛剛', 7 | ], 8 | 'second' => [ 9 | 'past' => '[1,Inf] %count% 秒前', 10 | 'future' => '[1,Inf] %count% 秒後', 11 | ], 12 | 'minute' => [ 13 | 'past' => '[1,Inf] %count% 分鐘前', 14 | 'future' => '[1,Inf] %count% 分鐘後', 15 | ], 16 | 'hour' => [ 17 | 'past' => '[1,Inf] %count% 小時前', 18 | 'future' => '[1,Inf] %count% 小時後', 19 | ], 20 | 'day' => [ 21 | 'past' => '[1,Inf] %count% 天前', 22 | 'future' => '[1,Inf] %count% 天後', 23 | ], 24 | 'week' => [ 25 | 'past' => '[1,Inf] %count% 週前', 26 | 'future' => '[1,Inf] %count% 週後', 27 | ], 28 | 'month' => [ 29 | 'past' => '[1,Inf] %count% 個月前', 30 | 'future' => '[1,Inf] %count% 個月後', 31 | ], 32 | 'year' => [ 33 | 'past' => '[1,Inf] %count% 年前', 34 | 'future' => '[1,Inf] %count% 年後', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,Inf] %count% 秒', 38 | 'minute' => '[1,Inf] %count% 分鐘', 39 | 'hour' => '[1,Inf] %count% 小時', 40 | 'day' => '[1,Inf] %count% 天', 41 | 'week' => '[1,Inf] %count% 週', 42 | 'month' => '[1,Inf] %count% 個月', 43 | 'year' => '[1,Inf] %count% 年', 44 | 'past' => '%value%前', 45 | 'future' => '%value%後', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/String/ShortcodeProcessor.php: -------------------------------------------------------------------------------- 1 | createShortcodeProcessor( 27 | function () : void { 28 | } 29 | )->process($text); 30 | } 31 | 32 | /** 33 | * Removes only shortcode tags from given text (leaves their content as it is). 34 | */ 35 | public function removeShortcodeTags(string $text) : string 36 | { 37 | return $this->createShortcodeProcessor(fn (ShortcodeInterface $s) : ?string => $s->getContent())->process($text); 38 | } 39 | 40 | private function createShortcodeProcessor(callable $defaultHandler) : Processor 41 | { 42 | $handlers = new HandlerContainer(); 43 | $handlers->setDefault($defaultHandler); 44 | 45 | return new Processor(new RegularParser(), $handlers); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Translator/Builder.php: -------------------------------------------------------------------------------- 1 | 21 | */ 22 | private static array $translators = []; 23 | 24 | public static function build(string $locale) : Translator 25 | { 26 | if (!isset(self::$translators[$locale])) { 27 | $translator = new Translator($locale); 28 | $translator->addLoader('php', new PhpFileLoader()); 29 | 30 | $iterator = new \FilesystemIterator(__DIR__ . '/../Resources/translations'); 31 | $filter = new \RegexIterator($iterator, '/[aA-zZ]+\.([a-z]{2}|[a-z]{2}\_[A-Z]{2})\.php$/'); 32 | 33 | /** @var \SplFileInfo $file */ 34 | foreach ($filter as $file) { 35 | $resourceName = $file->getBasename('.php'); 36 | [$fileDomain, $fileLocale] = \explode('.', $resourceName); 37 | $translator->addResource('php', $file->getPathname(), $fileLocale, $fileDomain); 38 | } 39 | 40 | self::$translators[$locale] = $translator; 41 | } 42 | 43 | return self::$translators[$locale]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Number/Ordinal/Builder.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] เมื่อสักครู่', 6 | 'future' => '[0,Inf] เร็วๆนี้', 7 | ], 8 | 'second' => [ 9 | 'past' => '[1,Inf] %count% วินาทีที่แล้ว', 10 | 'future' => '[1,Inf] อีก %count% วินาที', 11 | ], 12 | 'minute' => [ 13 | 'past' => '[1,Inf] %count% นาทีที่แล้ว', 14 | 'future' => '[1,Inf] อีก %count% นาที', 15 | ], 16 | 'hour' => [ 17 | 'past' => '[1,Inf] %count% ชั่วโมงที่แล้ว', 18 | 'future' => '[1,Inf] อีก %count% ชั่วโมง', 19 | ], 20 | 'day' => [ 21 | 'past' => '[1,Inf] %count% วันที่แล้ว', 22 | 'future' => '[1,Inf] อีก %count% วัน', 23 | ], 24 | 'week' => [ 25 | 'past' => '[1,Inf] %count% สัปดาห์ที่แล้ว', 26 | 'future' => '[1,Inf] อีก %count% สัปดาห์', 27 | ], 28 | 'month' => [ 29 | 'past' => '[1,Inf] %count% เดือนที่แล้ว', 30 | 'future' => '[1,Inf] อีก %count% เดือน', 31 | ], 32 | 'year' => [ 33 | 'past' => '[1,Inf] %count% ปีที่แล้ว', 34 | 'future' => '[1,Inf] อีก %count% ปี', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,Inf] %count% วินาที', 38 | 'minute' => '[1,Inf] %count% นาที', 39 | 'hour' => '[1,Inf] %count% ชั่วโมง', 40 | 'day' => '[1,Inf] %count% วัน', 41 | 'week' => '[1,Inf] %count% สัปดาห์', 42 | 'month' => '[1,Inf] %count% เดือน', 43 | 'year' => '[1,Inf] %count% ปี', 44 | 'past' => '%value%ที่แล้ว', 45 | 'future' => 'อีก %value%', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/DateIntervalCompound.php: -------------------------------------------------------------------------------- 1 | dateInterval = $dateInterval; 29 | } 30 | 31 | /** 32 | * @return array 33 | */ 34 | public function components() : array 35 | { 36 | /* @var Unit[] $units */ 37 | $units = [ 38 | new Year(), 39 | new Month(), 40 | new Day(), 41 | new Hour(), 42 | new Minute(), 43 | new Second(), 44 | ]; 45 | 46 | /** @var array $compoundResults */ 47 | $compoundResults = []; 48 | 49 | foreach ($units as $unit) { 50 | if ($this->dateInterval->{$unit->getDateIntervalSymbol()} > 0) { 51 | $compoundResults[] = new CompoundResult($unit, (int) $this->dateInterval->{$unit->getDateIntervalSymbol()}); 52 | } 53 | } 54 | 55 | return $compoundResults; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.ja.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] たった今', 6 | 'future' => '[0,Inf] たった今', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% 秒前|[2,Inf] %count% 秒前', 10 | 'future' => '[0,1] %count% 秒後|[2,Inf] %count% 秒後', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% 分前|[2,Inf] %count% 分前', 14 | 'future' => '{1} %count% 分後|[2,Inf] %count% 分後', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% 時間前|[2,Inf] %count% 時間前', 18 | 'future' => '{1} %count% 時間後|[2,Inf] %count% 時間後', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% 日前|[2,Inf] %count% 日前', 22 | 'future' => '{1} %count% 日後|[2,Inf] %count% 日後', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% 週間前|[2,Inf] %count% 週間前', 26 | 'future' => '{1} %count% 週間後|[2,Inf] %count% 週間後', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% ヶ月前|[2,Inf] %count% ヶ月前', 30 | 'future' => '{1} %count% ヶ月後|[2,Inf] %count% ヶ月後', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% 年前|[2,Inf] %count% 年前', 34 | 'future' => '{1} %count% 年後|[2,Inf] %count% 年後', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% 秒|[2,Inf] %count% 秒', 38 | 'minute' => '{1} %count% 分|[2,Inf] %count% 分', 39 | 'hour' => '{1} %count% 時間|[2,Inf] %count% 時間', 40 | 'day' => '{1} %count% 日|[2,Inf] %count% 日', 41 | 'week' => '{1} %count% 週間|[2,Inf] %count% 週間', 42 | 'month' => '{1} %count% 月|[2,Inf] %count% 月', 43 | 'year' => '{1} %count% 年|[2,Inf] %count% 年', 44 | 'past' => '%value%前', 45 | 'future' => '%value%後', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "coduo/php-humanizer", 3 | "type": "library", 4 | "description": "Humanize values that are readable only for developers", 5 | "keywords": ["php", "humanize", "humanizer"], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Michał Dąbrowski", 10 | "email": "dabrowski@brillante.pl" 11 | }, 12 | { 13 | "name": "Norbert Orzechowicz", 14 | "email": "norbert@orzechowicz.pl" 15 | } 16 | ], 17 | "require": { 18 | "php": "~8.3 || ~8.4 || ~8.5", 19 | "symfony/translation": "~5.4 || ~6.4 || ~7 || ~8" 20 | }, 21 | "require-dev": { 22 | "thunderer/shortcode": "^0.7", 23 | "aeon-php/calendar": "^1.0" 24 | }, 25 | "config": { 26 | "bin-dir": "bin" 27 | }, 28 | "autoload": { 29 | "psr-4": { 30 | "": "src/" 31 | } 32 | }, 33 | "autoload-dev": { 34 | "psr-4": { 35 | "": "tests/" 36 | } 37 | }, 38 | "suggest": { 39 | "ext-intl": "Required if you are going to use humanizer with locales different than en_EN" 40 | }, 41 | "scripts": { 42 | "build": [ 43 | "@static:analyze", 44 | "@test" 45 | ], 46 | "test": [ 47 | "tools/vendor/bin/phpunit" 48 | ], 49 | "static:analyze": [ 50 | "tools/vendor/bin/phpstan analyze -c phpstan.neon", 51 | "tools/vendor/bin/php-cs-fixer fix --dry-run" 52 | ], 53 | "cs:php:fix": "tools/vendor/bin/php-cs-fixer fix", 54 | "tools:install": "composer install --working-dir=./tools", 55 | "tools:update": "composer update --working-dir=./tools", 56 | "post-install-cmd": [ 57 | "@tools:install" 58 | ], 59 | "post-update-cmd": [ 60 | "@tools:update" 61 | ] 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/PreciseFormatter.php: -------------------------------------------------------------------------------- 1 | translator = $translator; 24 | } 25 | 26 | public function formatDifference(PreciseDifference $difference, string $locale = 'en') : string 27 | { 28 | $diff = []; 29 | 30 | foreach ($difference->components() as $result) { 31 | $diff[] = $this->translator->trans( 32 | 'compound.' . $result->getUnit()->getName(), 33 | ['%count%' => $result->getQuantity()], 34 | 'difference', 35 | $locale 36 | ); 37 | } 38 | 39 | return $this->translator->trans( 40 | 'compound.' . ($difference->isPast() ? 'past' : 'future'), 41 | ['%value%' => \implode(', ', $diff)], 42 | 'difference', 43 | $locale 44 | ); 45 | } 46 | 47 | public function formatInterval(\DateInterval $dateInterval, string $locale = 'en') : string 48 | { 49 | $parts = []; 50 | 51 | foreach ((new DateIntervalCompound($dateInterval))->components() as $component) { 52 | $parts[] = $this->translator->trans( 53 | 'compound.' . $component->getUnit()->getName(), 54 | ['%count%' => $component->getQuantity()], 55 | 'difference', 56 | $locale 57 | ); 58 | } 59 | 60 | return CollectionHumanizer::oxford($parts, null, $locale); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.tr.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] şimdi', 6 | 'future' => '[0,Inf] şimdi', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% saniye önce|[2,Inf] %count% saniye önce', 10 | 'future' => '[0,1] %count% saniye sonra|[2,Inf] %count% saniye sonra', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% dakika önce|[2,Inf] %count% dakika önce', 14 | 'future' => '{1} %count% dakika sonra|[2,Inf] %count% dakika sonra', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% saat önce|[2,Inf] %count% saat önce', 18 | 'future' => '{1} %count% saat sonra|[2,Inf] %count% saat sonra', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% gün önce|[2,Inf] %count% gün önce', 22 | 'future' => '{1} %count% gün sonra|[2,Inf] %count% gün sonra', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% hafta önce|[2,Inf] %count% hafta önce', 26 | 'future' => '{1} %count% hafta sonra|[2,Inf] %count% hafta sonra', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% ay önce|[2,Inf] %count% ay önce', 30 | 'future' => '{1} %count% ay sonra|[2,Inf] %count% ay sonra', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% yıl önce|[2,Inf] %count% yıl önce', 34 | 'future' => '{1} %count% yıl sonra|[2,Inf] %count% yıl sonra', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% saniye|[2,Inf] %count% saniye', 38 | 'minute' => '{1} %count% dakika|[2,Inf] %count% dakika', 39 | 'hour' => '{1} %count% saat|[2,Inf] %count% saat', 40 | 'day' => '{1} %count% gün|[2,Inf] %count% gün', 41 | 'week' => '{1} %count% hafta|[2,Inf] %count% hafta', 42 | 'month' => '{1} %count% ay|[2,Inf] %count% ay', 43 | 'year' => '{1} %count% yıl|[2,Inf] %count% yıl', 44 | 'past' => '%value% önce', 45 | 'future' => '%value% sonra', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.az.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] indi', 6 | 'future' => '[0,Inf] indi', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% saniyə əvvəl|[2,Inf] %count% saniyə əvvəl', 10 | 'future' => '[0,1] %count% saniyə sonra|[2,Inf] %count% saniyə sonra', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% dəqiqə əvvəl|[2,Inf] %count% dəqiqə əvvəl', 14 | 'future' => '{1} %count% dəqiqə sonra|[2,Inf] %count% dəqiqə sonra', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% saat əvvəl|[2,Inf] %count% saat əvvəl', 18 | 'future' => '{1} %count% saat sonra|[2,Inf] %count% saat sonra', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% gün əvvəl|[2,Inf] %count% gün əvvəl', 22 | 'future' => '{1} %count% gün sonra|[2,Inf] %count% gün sonra', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% həftə əvvəl|[2,Inf] %count% həftə əvvəl', 26 | 'future' => '{1} %count% həftə sonra|[2,Inf] %count% həftə sonra', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% ay əvvəl|[2,Inf] %count% ay əvvəl', 30 | 'future' => '{1} %count% ay sonra|[2,Inf] %count% ay sonra', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% il əvvəl|[2,Inf] %count% il əvvəl', 34 | 'future' => '{1} %count% il sonra|[2,Inf] %count% il sonra', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% saniyə|[2,Inf] %count% saniyə', 38 | 'minute' => '{1} %count% dəqiqə|[2,Inf] %count% dəqiqə', 39 | 'hour' => '{1} %count% saat|[2,Inf] %count% saat', 40 | 'day' => '{1} %count% gün|[2,Inf] %count% gün', 41 | 'week' => '{1} %count% həftə|[2,Inf] %count% həftə', 42 | 'month' => '{1} %count% ay|[2,Inf] %count% ay', 43 | 'year' => '{1} %count% il|[2,Inf] %count% il', 44 | 'past' => '%value% əvvəl', 45 | 'future' => '%value% sonra', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.de.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] jetzt gerade', 6 | 'future' => '[0,Inf] jetzt gerade', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] vor %count% Sekunde|[2,Inf] vor %count% Sekunden', 10 | 'future' => '[0,1] in %count% Sekunde|[2,Inf] in %count% Sekunden', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} vor %count% Minute|[2,Inf] vor %count% Minuten', 14 | 'future' => '{1} in %count% Minute|[2,Inf] in %count% Minuten', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} vor %count% Stunde|[2,Inf] vor %count% Stunden', 18 | 'future' => '{1} in %count% Stunde|[2,Inf] in %count% Stunden', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} vor %count% Tag|[2,Inf] vor %count% Tagen', 22 | 'future' => '{1} in %count% Tag|[2,Inf] in %count% Tagen', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} vor %count% Woche|[2,Inf] vor %count% Wochen', 26 | 'future' => '{1} in %count% Woche|[2,Inf] in %count% Wochen', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} vor %count% Monat|[2,Inf] vor %count% Monaten', 30 | 'future' => '{1} in %count% Monat|[2,Inf] in %count% Monaten', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} vor %count% Jahr|[2,Inf] vor %count% Jahren', 34 | 'future' => '{1} in %count% Jahr|[2,Inf] in %count% Jahren', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% Sekunde|[2,Inf] %count% Sekunden', 38 | 'minute' => '{1} %count% Minute|[2,Inf] %count% Minuten', 39 | 'hour' => '{1} %count% Stunde|[2,Inf] %count% Stunden', 40 | 'day' => '{1} %count% Tag|[2,Inf] %count% Tagen', 41 | 'week' => '{1} %count% Woche|[2,Inf] %count% Wochen', 42 | 'month' => '{1} %count% Monat|[2,Inf] %count% Monaten', 43 | 'year' => '{1} %count% Jahr|[2,Inf] %count% Jahren', 44 | 'past' => 'vor %value%', 45 | 'future' => 'in %value%', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.da.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] lige nu', 6 | 'future' => '[0,Inf] lige nu', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% sekund siden|[2,Inf] %count% sekunder siden', 10 | 'future' => '[0,1] %count% sekund fra nu|[2,Inf] %count% sekunder fra nu', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minut siden|[2,Inf] %count% minutter siden', 14 | 'future' => '{1} %count% minut fra nu|[2,Inf] %count% minutter fra nu', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% time siden|[2,Inf] %count% timer siden', 18 | 'future' => '{1} %count% time fra nu|[2,Inf] %count% timer fra nu', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% dag siden|[2,Inf] %count% dage siden', 22 | 'future' => '{1} %count% dag fra nu|[2,Inf] %count% dage fra nu', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% uge siden|[2,Inf] %count% uger siden', 26 | 'future' => '{1} %count% uge fra nu|[2,Inf] %count% uger fra nu', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% måned siden|[2,Inf] %count% måneder siden', 30 | 'future' => '{1} %count% måned fra nu|[2,Inf] %count% måneder fra nu', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% år siden|[2,Inf] %count% år siden', 34 | 'future' => '{1} %count% år fra nu|[2,Inf] %count% år fra nu', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% sekund|[2,Inf] %count% sekunder', 38 | 'minute' => '{1} %count% minut|[2,Inf] %count% minutter', 39 | 'hour' => '{1} %count% time|[2,Inf] %count% timer', 40 | 'day' => '{1} %count% dag|[2,Inf] %count% dage', 41 | 'week' => '{1} %count% uge|[2,Inf] %count% uger', 42 | 'month' => '{1} %count% måned|[2,Inf] %count% måneder', 43 | 'year' => '{1} %count% år|[2,Inf] %count% år', 44 | 'past' => '%value% siden', 45 | 'future' => '%value% fra nu', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.bg.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] в момента', 6 | 'future' => '[0,Inf] в момента', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] преди %count% секунда|[2,Inf] преди %count% секунди', 10 | 'future' => '[0,1] след %count% секунда|[2,Inf] след %count% секунди', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} преди %count% минута|[2,Inf] преди %count% минути', 14 | 'future' => '{1} след %count% минута|[2,Inf] след %count% минути', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} преди %count% час|[2,Inf] преди %count% часа', 18 | 'future' => '{1} след %count% час|[2,Inf] след %count% часа', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} преди %count% ден|[2,Inf] преди %count% дни', 22 | 'future' => '{1} след %count% ден|[2,Inf] след %count% дни', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} преди %count% седмица|[2,Inf] преди %count% седмици', 26 | 'future' => '{1} след %count% седмица|[2,Inf] след %count% седмици', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} преди %count% месец|[2,Inf] преди %count% месеца', 30 | 'future' => '{1} след %count% месец|[2,Inf] след %count% месеца', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} преди %count% година|[2,Inf] преди %count% години', 34 | 'future' => '{1} след %count% година|[2,Inf] след %count% години', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% секунда|[2,Inf] %count% секунди', 38 | 'minute' => '{1} %count% минута|[2,Inf] %count% минути', 39 | 'hour' => '{1} %count% час|[2,Inf] %count% часа', 40 | 'day' => '{1} %count% ден|[2,Inf] %count% дни', 41 | 'week' => '{1} %count% седмица|[2,Inf] %count% седмица', 42 | 'month' => '{1} %count% месец|[2,Inf] %count% месеца', 43 | 'year' => '{1} %count% година|[2,Inf] %count% години', 44 | 'past' => '%value% преди това', 45 | 'future' => '%value% след това', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.no.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] akkurat nå', 6 | 'future' => '[0,Inf] akkurat nå', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% sekund siden|[2,Inf] %count% sekunder siden', 10 | 'future' => '[0,1] %count% sekund fra nå|[2,Inf] %count% sekunder fra nå', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minutt siden|[2,Inf] %count% minutter siden', 14 | 'future' => '{1} %count% minutt fra nå|[2,Inf] %count% minutter fra nå', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% time siden|[2,Inf] %count% timer siden', 18 | 'future' => '{1} %count% time fra nå|[2,Inf] %count% timer fra nå', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% dag siden|[2,Inf] %count% dager siden', 22 | 'future' => '{1} %count% dag fra nå|[2,Inf] %count% dager fra nå', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% uke siden|[2,Inf] %count% uker siden', 26 | 'future' => '{1} %count% uke fra nå|[2,Inf] %count% uker fra nå', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% måned siden|[2,Inf] %count% måneder siden', 30 | 'future' => '{1} %count% måned fra nå|[2,Inf] %count% måneder fra nå', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% år siden|[2,Inf] %count% år siden', 34 | 'future' => '{1} %count% år fra nå|[2,Inf] %count% år fra nå', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% sekund|[2,Inf] %count% sekunder', 38 | 'minute' => '{1} %count% minutt|[2,Inf] %count% minutter', 39 | 'hour' => '{1} %count% time|[2,Inf] %count% timer', 40 | 'day' => '{1} %count% dag|[2,Inf] %count% dager', 41 | 'week' => '{1} %count% uke|[2,Inf] %count% uker', 42 | 'month' => '{1} %count% måned|[2,Inf] %count% måneder', 43 | 'year' => '{1} %count% år|[2,Inf] %count% år', 44 | 'past' => '%value% siden', 45 | 'future' => '%value% fra nå', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.en.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] just now', 6 | 'future' => '[0,Inf] just now', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% second ago|[2,Inf] %count% seconds ago', 10 | 'future' => '[0,1] %count% second from now|[2,Inf] %count% seconds from now', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minute ago|[2,Inf] %count% minutes ago', 14 | 'future' => '{1} %count% minute from now|[2,Inf] %count% minutes from now', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% hour ago|[2,Inf] %count% hours ago', 18 | 'future' => '{1} %count% hour from now|[2,Inf] %count% hours from now', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% day ago|[2,Inf] %count% days ago', 22 | 'future' => '{1} %count% day from now|[2,Inf] %count% days from now', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% week ago|[2,Inf] %count% weeks ago', 26 | 'future' => '{1} %count% week from now|[2,Inf] %count% weeks from now', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% month ago|[2,Inf] %count% months ago', 30 | 'future' => '{1} %count% month from now|[2,Inf] %count% months from now', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% year ago|[2,Inf] %count% years ago', 34 | 'future' => '{1} %count% year from now|[2,Inf] %count% years from now', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% second|[2,Inf] %count% seconds', 38 | 'minute' => '{1} %count% minute|[2,Inf] %count% minutes', 39 | 'hour' => '{1} %count% hour|[2,Inf] %count% hours', 40 | 'day' => '{1} %count% day|[2,Inf] %count% days', 41 | 'week' => '{1} %count% week|[2,Inf] %count% weeks', 42 | 'month' => '{1} %count% month|[2,Inf] %count% months', 43 | 'year' => '{1} %count% year|[2,Inf] %count% years', 44 | 'past' => '%value% ago', 45 | 'future' => '%value% from now', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.nl.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] zojuist', 6 | 'future' => '[0,Inf] zojuist', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% seconde geleden|[2,Inf] %count% seconden geleden', 10 | 'future' => '[0,1] over %count% seconde|[2,Inf] over %count% seconden', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minuut geleden|[2,Inf] %count% minuten geleden', 14 | 'future' => '{1} over %count% minuut|[2,Inf] over %count% minuten', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% uur geleden|[2,Inf] %count% uren geleden', 18 | 'future' => '{1} over %count% uur|[2,Inf] over %count% uren', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% dag geleden|[2,Inf] %count% dagen geleden', 22 | 'future' => '{1} over %count% dag|[2,Inf] over %count% dagen', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% week geleden|[2,Inf] %count% weken geleden', 26 | 'future' => '{1} over %count% week|[2,Inf] over %count% weken', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% maand geleden|[2,Inf] %count% maanden geleden', 30 | 'future' => '{1} over %count% maand|[2,Inf] over %count% maanden', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% jaar geleden|[2,Inf] %count% jaren geleden', 34 | 'future' => '{1} over %count% jaar|[2,Inf] over %count% jaren', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% seconde|[2,Inf] %count% seconden', 38 | 'minute' => '{1} %count% minuut|[2,Inf] %count% minuten', 39 | 'hour' => '{1} %count% uur|[2,Inf] %count% uren', 40 | 'day' => '{1} %count% dag|[2,Inf] %count% dagen', 41 | 'week' => '{1} %count% week|[2,Inf] %count% weken', 42 | 'month' => '{1} %count% maand|[2,Inf] %count% maanden', 43 | 'year' => '{1} %count% jaar|[2,Inf] %count% jaren', 44 | 'past' => '%value% geleden', 45 | 'future' => '%value% vanaf nu', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.it.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] adesso', 6 | 'future' => '[0,Inf] adesso', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% secondo fa|[2,Inf] %count% secondi fa', 10 | 'future' => '[0,1] %count% secondo da adesso|[2,Inf] %count% secondi da adesso', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minuto fa|[2,Inf] %count% minuti fa', 14 | 'future' => '{1} %count% minuto da adesso|[2,Inf] %count% minuti da adesso', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% ora fa|[2,Inf] %count% ore fa', 18 | 'future' => '{1} %count% ora da adesso|[2,Inf] %count% ore da adesso', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% giorno fa|[2,Inf] %count% giorni fa', 22 | 'future' => '{1} %count% giorno da adesso|[2,Inf] %count% giorni da adesso', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% settimana fa|[2,Inf] %count% settimane fa', 26 | 'future' => '{1} %count% settimana da adesso|[2,Inf] %count% settimane da adesso', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% mese fa|[2,Inf] %count% mesi fa', 30 | 'future' => '{1} %count% mese da adesso|[2,Inf] %count% mesi da adesso', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% anno fa|[2,Inf] %count% anni fa', 34 | 'future' => '{1} %count% anno da adesso|[2,Inf] %count% anni da adesso', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% secondo|[2,Inf] %count% secondi', 38 | 'minute' => '{1} %count% minuto|[2,Inf] %count% minuti', 39 | 'hour' => '{1} %count% ora|[2,Inf] %count% ore', 40 | 'day' => '{1} %count% giorno|[2,Inf] %count% giorni', 41 | 'week' => '{1} %count% settimana|[2,Inf] %count% settimane', 42 | 'month' => '{1} %count% mese|[2,Inf] %count% mesi', 43 | 'year' => '{1} %count% anno|[2,Inf] %count% anni', 44 | 'past' => '%value% fa', 45 | 'future' => '%value% da adesso', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.ro.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] mai înainte', 6 | 'future' => '[0,Inf] imediat', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% secundă în urmă|[2,Inf] %count% secunde în urmă', 10 | 'future' => '[0,1] %count% secundă de acum|[2,Inf] %count% secundă de acum', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minut în urmă|[2,Inf] %count% minute în urmă', 14 | 'future' => '{1} %count% minut de acum|[2,Inf] %count% minute de acum', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% oră în urmă|[2,Inf] %count% ore în urmă', 18 | 'future' => '{1} %count% oră de acum|[2,Inf] %count% ore de acum', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% zi în urmă|[2,Inf] %count% zile în urmă', 22 | 'future' => '{1} %count% zi de acum|[2,Inf] %count% zile de acum', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% săptămână în urmă|[2,Inf] %count% săptămâni în urmă', 26 | 'future' => '{1} %count% săptămână de acum|[2,Inf] %count% săptămâni de acum', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% lună în urmă|[2,Inf] %count% luni în urmă', 30 | 'future' => '{1} %count% lună de acum|[2,Inf] %count% luni de acum', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% an în urmă|[2,Inf] %count% ani în urmă', 34 | 'future' => '{1} %count% an de acum|[2,Inf] %count% ani de acum', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% secundă|[2,Inf] %count% secunde', 38 | 'minute' => '{1} %count% minut|[2,Inf] %count% minute', 39 | 'hour' => '{1} %count% oră|[2,Inf] %count% ore', 40 | 'day' => '{1} %count% zi|[2,Inf] %count% zile', 41 | 'week' => '{1} %count% săptămană|[2,Inf] %count% săptămani', 42 | 'month' => '{1} %count% lună|[2,Inf] %count% luni', 43 | 'year' => '{1} %count% an|[2,Inf] %count% ani', 44 | 'ago' => 'în urmă', 45 | 'from_now' => 'de acum', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.es.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] ahora mismo', 6 | 'future' => '[0,Inf] ahora mismo', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] hace %count% segundo |[2,Inf] hace %count% segundos', 10 | 'future' => '[0,1] dentro de %count% segundo|[2,Inf] dentro de %count% segundos', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} hace %count% minuto|[2,Inf] hace %count% minutos', 14 | 'future' => '{1} dentro de %count% minuto|[2,Inf] dentro de %count% minutos', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} hace %count% hora|[2,Inf] hace %count% horas', 18 | 'future' => '{1} dentro de %count% hora|[2,Inf] dentro de %count% horas', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} hace %count% día|[2,Inf] hace %count% días', 22 | 'future' => '{1} dentro de %count% día|[2,Inf] dentro de %count% días', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} hace %count% semana|[2,Inf] hace %count% semanas', 26 | 'future' => '{1} dentro de %count% semana|[2,Inf] dentro de %count% semanas', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} hace %count% mes|[2,Inf] hace %count% meses', 30 | 'future' => '{1} dentro de %count% mes|[2,Inf] dentro de %count% meses', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} hace %count% año|[2,Inf] hace %count% años', 34 | 'future' => '{1} dentro de %count% año|[2,Inf] dentro de %count% años', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% segundo|[2,Inf] %count% segundos', 38 | 'minute' => '{1} %count% minuto|[2,Inf] %count% minutos', 39 | 'hour' => '{1} %count% hora|[2,Inf] %count% horas', 40 | 'day' => '{1} %count% día|[2,Inf] %count% días', 41 | 'week' => '{1} %count% semana|[2,Inf] %count% semanas', 42 | 'month' => '{1} %count% mes|[2,Inf] %count% meses', 43 | 'year' => '{1} %count% año|[2,Inf] %count% años', 44 | 'past' => 'hace %value%', 45 | 'future' => 'dentro de %value%', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.af.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] nou nou', 6 | 'future' => '[0,Inf] netnou', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% sekonde gelede|[2,Inf] %count% sekondes gelede', 10 | 'future' => '[0,1] %count% sekonde van nou af|[2,Inf] %count% sekondes van nou af', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minuut gelede|[2,Inf] %count% minute gelede', 14 | 'future' => '{1} %count% minuut van nou af|[2,Inf] %count% minute van nou af', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% uur gelede|[2,Inf] %count% ure gelede', 18 | 'future' => '{1} %count% uur van nou af|[2,Inf] %count% ure van nou af', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% dag gelede|[2,Inf] %count% dae gelede', 22 | 'future' => '{1} %count% dag van nou af|[2,Inf] %count% dae van nou af', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% week gelede|[2,Inf] %count% weke gelede', 26 | 'future' => '{1} %count% week van nou af|[2,Inf] %count% weke van nou af', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% maand gelede|[2,Inf] %count% maande gelede', 30 | 'future' => '{1} %count% maand van nou af|[2,Inf] %count% maande van nou af', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% jaar gelede|[2,Inf] %count% jaar gelede', 34 | 'future' => '{1} %count% jaar van nou af|[2,Inf] %count% jaar van nou af', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% sekonde|[2,Inf] %count% sekondes', 38 | 'minute' => '{1} %count% minuut|[2,Inf] %count% minute', 39 | 'hour' => '{1} %count% uur|[2,Inf] %count% ure', 40 | 'day' => '{1} %count% dag|[2,Inf] %count% dae', 41 | 'week' => '{1} %count% week|[2,Inf] %count% weke', 42 | 'month' => '{1} %count% maand|[2,Inf] %count% maande', 43 | 'year' => '{1} %count% jaar|[2,Inf] %count% jaar', 44 | 'past' => '%value% gelede', 45 | 'future' => '%value% van nou af', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.ru.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] сейчас', 6 | 'future' => '[0,Inf] сейчас', 7 | ], 8 | 'second' => [ 9 | 'past' => '%count% секунду назад|%count% секунды назад|%count% секунд назад', 10 | 'future' => 'через %count% секунду|через %count% секунды|через %count% секунд', 11 | ], 12 | 'minute' => [ 13 | 'past' => '%count% минуту назад|%count% минуты назад|%count% минут назад', 14 | 'future' => 'через %count% минуту|через %count% минуты|через %count% минут', 15 | ], 16 | 'hour' => [ 17 | 'past' => '%count% час назад|%count% часа назад|%count% часов назад', 18 | 'future' => 'через %count% час|через %count% часа|через %count% часов', 19 | ], 20 | 'day' => [ 21 | 'past' => '%count% день назад|%count% дня назад|%count% дней назад', 22 | 'future' => 'через %count% день|через %count% дня|через %count% дней', 23 | ], 24 | 'week' => [ 25 | 'past' => '%count% неделю назад|%count% недели назад|%count% недель назад', 26 | 'future' => 'через %count% неделю|через %count% недели|через %count% недель', 27 | ], 28 | 'month' => [ 29 | 'past' => '%count% месяц назад|%count% месяца назад|%count% месяцев назад', 30 | 'future' => 'через %count% месяц|через %count% месяца|через %count% месяцев', 31 | ], 32 | 'year' => [ 33 | 'past' => '%count% год назад|%count% года назад|%count% лет назад', 34 | 'future' => 'через %count% год|через %count% года|через %count% лет', 35 | ], 36 | 'compound' => [ 37 | 'second' => '%count% секунда|%count% секунды|%count% секунд', 38 | 'minute' => '%count% минута|%count% минуты|%count% минут', 39 | 'hour' => '%count% час|%count% часа|%count% часов', 40 | 'day' => '%count% день|%count% дня|%count% дней', 41 | 'week' => '%count% неделя|%count% недели|%count% недель', 42 | 'month' => '%count% месяц|%count% месяца|%count% месяцев', 43 | 'year' => '%count% год|%count% года|%count% лет', 44 | 'past' => '%value% назад', 45 | 'future' => 'через %value%', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.uk.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] зараз', 6 | 'future' => '[0,Inf] зараз', 7 | ], 8 | 'second' => [ 9 | 'past' => '%count% секунду тому|%count% секунди тому|%count% секунд тому', 10 | 'future' => 'через %count% секунду|через %count% секунди|через %count% секунд', 11 | ], 12 | 'minute' => [ 13 | 'past' => '%count% хвилину тому|%count% хвилини тому|%count% хвилин тому', 14 | 'future' => 'через %count% хвилину|через %count% хвилини|через %count% хвилин', 15 | ], 16 | 'hour' => [ 17 | 'past' => '%count% годину тому|%count% години тому|%count% годин тому', 18 | 'future' => 'через %count% годину|через %count% години|через %count% годин', 19 | ], 20 | 'day' => [ 21 | 'past' => '%count% день тому|%count% дні тому|%count% днів тому', 22 | 'future' => 'через %count% день|через %count% дні|через %count% днів', 23 | ], 24 | 'week' => [ 25 | 'past' => '%count% тиждень тому|%count% тижні тому|%count% тижнів тому', 26 | 'future' => 'через %count% тиждень|через %count% тижні|через %count% тижнів', 27 | ], 28 | 'month' => [ 29 | 'past' => '%count% місяць тому|%count% місяці тому|%count% місяців тому', 30 | 'future' => 'через %count% місяць|через %count% місяці|через %count% місяців', 31 | ], 32 | 'year' => [ 33 | 'past' => '%count% рік тому|%count% роки тому|%count% років тому', 34 | 'future' => 'через %count% рік|через %count% роки|через %count% років', 35 | ], 36 | 'compound' => [ 37 | 'second' => '%count% секунда|%count% секунди|%count% секунд', 38 | 'minute' => '%count% хвилина|%count% хвилини|%count% хвилин', 39 | 'hour' => '%count% година|%count% години|%count% годин', 40 | 'day' => '%count% день|%count% дні|%count% днів', 41 | 'week' => '%count% тиждень|%count% тижні|%count% тижнів', 42 | 'month' => '%count% місяць|%count% місяця|%count% місяців', 43 | 'year' => '%count% рік|%count% роки|%count% років', 44 | 'past' => '%value% тому', 45 | 'future' => 'через %value%', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.sv.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] nyss', 6 | 'future' => '[0,Inf] nyss', 7 | ], 8 | 'second' => [ 9 | 'past' => '{0} för 0 sekunder sedan|{1} för 1 sekund sedan|[2,Inf] för %count% sekunder sedan', 10 | 'future' => '{0} om 0 sekunder|{1} om 1 sekund|[2,Inf] om %count% sekunder', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{0} för 0 minuter sedan|{1} för 1 minut sedan|[2,Inf] för %count% minuter sedan', 14 | 'future' => '{0} om 0 minuter|{1} om 1 minut|[2,Inf] om %count% minuter', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{0} för 0 timmar sedan|{1} för 1 timme sedan|[2,Inf] för %count% timmar sedan', 18 | 'future' => '{0} om 0 timmar|{1} om 1 timme|[2,Inf] om %count% timmar', 19 | ], 20 | 'day' => [ 21 | 'past' => '{0} för 0 dagar sedan|{1} för 1 dag sedan|[2,Inf] för %count% dagar sedan', 22 | 'future' => '{0} om 0 dagar|{1} om 1 dag|[2,Inf] om %count% dagar', 23 | ], 24 | 'week' => [ 25 | 'past' => '{0} för 0 veckor sedan|{1} för 1 vecka sedan|[2,Inf] för %count% veckor sedan', 26 | 'future' => '{0} om 0 veckor|{1} om 1 vecka|[2,Inf] om %count% veckor', 27 | ], 28 | 'month' => [ 29 | 'past' => '{0} för 0 månader sedan|{1} för 1 månad sedan|[2,Inf] för %count% månader sedan', 30 | 'future' => '{0} om 0 månader|{1} om 1 månad|[2,Inf] om %count% månader', 31 | ], 32 | 'year' => [ 33 | 'past' => '[0,Inf] för %count% år sedan', 34 | 'future' => '[0,Inf] om %count% år', 35 | ], 36 | 'compound' => [ 37 | 'second' => '{0} 0 sekunder|{1} 1 sekund|[2,Inf] %count% sekunder', 38 | 'minute' => '{0} 0 minuter|{1} 1 minut|[2,Inf] %count% minuter', 39 | 'hour' => '{0} 0 timmar|{1} 1 timme|[2,Inf] %count% timmar', 40 | 'day' => '{0} 0 dagar|{1} 1 dag|[2,Inf] %count% dagar', 41 | 'week' => '{0} 0 veckor|{1} 1 vecka|[2,Inf] %count% veckor', 42 | 'month' => '{0} 0 månader|{1} 1 månad|[2,Inf] %count% månader', 43 | 'year' => '[0,Inf] %count% år', 44 | 'past' => 'för %value% sedan', 45 | 'future' => 'om %value%', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.id.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] baru saja', 6 | 'future' => '[0,Inf] baru saja', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% detik yang lalu|[2,Inf] %count% detik yang lalu', 10 | 'future' => '[0,1] %count% detik dari sekarang|[2,Inf] %count% detik dari sekarang', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% menit yang lalu|[2,Inf] %count% menit yang lalu', 14 | 'future' => '{1} %count% menit dari sekarang|[2,Inf] %count% menit dari sekarang', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% jam yang lalu|[2,Inf] %count% jam yang lalu', 18 | 'future' => '{1} %count% jam dari sekarang|[2,Inf] %count% jam dari sekarang', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% hari yang lalu|[2,Inf] %count% hari yang lalu', 22 | 'future' => '{1} %count% hari dari sekarang|[2,Inf] %count% hari dari sekarang', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% minggu yang lalu|[2,Inf] %count% minggu yang lalu', 26 | 'future' => '{1} %count% minggu dari sekarang|[2,Inf] %count% minggu dari sekarang', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% bulan yang lalu|[2,Inf] %count% bulan yang lalu', 30 | 'future' => '{1} %count% bulan dari sekarang|[2,Inf] %count% bulan dari sekarang', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% tahun yang lalu|[2,Inf] %count% tahun yang lalu', 34 | 'future' => '{1} %count% tahun dari sekarang|[2,Inf] %count% tahun dari sekarang', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% detik|[2,Inf] %count% detik', 38 | 'minute' => '{1} %count% menit|[2,Inf] %count% menit', 39 | 'hour' => '{1} %count% jam|[2,Inf] %count% jam', 40 | 'day' => '{1} %count% hari|[2,Inf] %count% hari', 41 | 'week' => '{1} %count% minggu|[2,Inf] %count% minggu', 42 | 'month' => '{1} %count% bulan|[2,Inf] %count% bulan', 43 | 'year' => '{1} %count% tahun|[2,Inf] %count% tahun', 44 | 'past' => '%value% yang lalu', 45 | 'future' => '%value% dari sekarang', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.pt.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] agora', 6 | 'future' => '[0,Inf] agora', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% segundo atrás|[2,Inf] %count% segundos atrás', 10 | 'future' => '[0,1] %count% segundo a partir de agora|[2,Inf] %count% segundos a partir de agora', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minuto atrás|[2,Inf] %count% minutos atrás', 14 | 'future' => '{1} %count% minuto a partir de agora|[2,Inf] %count% minutos a partir de agora', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% hora atrás|[2,Inf] %count% horas atrás', 18 | 'future' => '{1} %count% hora a partir de agora|[2,Inf] %count% horas a partir de agora', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% dia atrás|[2,Inf] %count% dias atrás', 22 | 'future' => '{1} %count% dia a partir de agora|[2,Inf] %count% dias a partir de agora', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% semana atrás|[2,Inf] %count% semanas atrás', 26 | 'future' => '{1} %count% semana a partir de agora|[2,Inf] %count% semanas a partir de agora', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% mês atrás|[2,Inf] %count% meses atrás', 30 | 'future' => '{1} %count% mês a partir de agora|[2,Inf] %count% meses a partir de agora', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% ano atrás|[2,Inf] %count% anos atrás', 34 | 'future' => '{1} %count% ano a partir de agora|[2,Inf] %count% anos a partir de agora', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% segundo|[2,Inf] %count% segundos', 38 | 'minute' => '{1} %count% minuto|[2,Inf] %count% minutos', 39 | 'hour' => '{1} %count% hora|[2,Inf] %count% horas', 40 | 'day' => '{1} %count% dia|[2,Inf] %count% dias', 41 | 'week' => '{1} %count% semana|[2,Inf] %count% semana', 42 | 'month' => '{1} %count% mês|[2,Inf] %count% meses', 43 | 'year' => '{1} %count% ano|[2,Inf] %count% anos', 44 | 'past' => '%value% atrás', 45 | 'future' => '%value% a partir de agora', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.cs.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] právě teď', 6 | 'future' => '[0,Inf] právě teď', 7 | ], 8 | 'second' => [ 9 | 'past' => '{1} před vteřinou|[2, 4] před %count% vteřinami|[5,Inf] před %count% vteřinami', 10 | 'future' => '{1} za vteřinu|[2, 4] za %count% vteřiny|[5,Inf] za %count% vteřin', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} před minutou|[2, Inf] před %count% minutami', 14 | 'future' => '{1} za minutu|[2, 4] za %count% minuty|[5,Inf] za %count% minut', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} před hodinou|[2, Inf] před %count% hodinami', 18 | 'future' => '{1} za hodinu|[2, 4] za %count% hodiny|[5,Inf] za %count% hodin', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} včera|[2, Inf] před %count% dny', 22 | 'future' => '{1} zítra|[2, 4] za %count% dny|[5,Inf] za %count% dní', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} minulý týden|[2, Inf] před %count% týdny', 26 | 'future' => '{1} za týden|[2, 4] za %count% týdny|[5,Inf] za %count% týdnů', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} minulý měsíc|[2, Inf] před %count% měsíci', 30 | 'future' => '{1} za měsíc|[2, 4] za %count% měsíce|[5,Inf] za %count% měsíců', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} minulý rok|[2, Inf] před %count% lety', 34 | 'future' => '{1} za rok|[2, 4] za %count% roky|[5,Inf] za %count% let', 35 | ], 36 | 'compound' => [ 37 | 'second' => '{1} %count% vteřina |[2,4] %count% vteřiny|[5,Inf] %count% vteřin', 38 | 'minute' => '{1} %count% minuta|[2,4] %count% minuty|[5,Inf] %count% minut', 39 | 'hour' => '{1} %count% hodina|[2,4] %count% hodiny|[5,Inf] %count% hodin', 40 | 'day' => '{1} %count% den |[2,4] %count% dny|[5,Inf] %count% dní', 41 | 'week' => '{1} %count% týden|[2,4] %count% týdny|[5,Inf] %count% týdnů', 42 | 'month' => '{1} %count% měsíc|[2,4] %count% měsíce|[5,Inf] %count% měsíců', 43 | 'year' => '{1} %count% rok|[2,4] %count% roky|[5,Inf] %count% let', 44 | 'past' => 'před %value% ', 45 | 'future' => '%value% odteď', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.pt_BR.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] atrás', 6 | 'future' => '[0,Inf] a partir de agora', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] %count% segundo atrás|[2,Inf] %count% segundos atrás', 10 | 'future' => '[0,1] %count% segundo a partir de agora|[2,Inf] %count% segundos a partir de agora', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} %count% minuto atrás|[2,Inf] %count% minutos atrás', 14 | 'future' => '{1} %count% minuto a partir de agora|[2,Inf] %count% minutos a partir de agora', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} %count% hora atrás|[2,Inf] %count% horas atrás', 18 | 'future' => '{1} %count% hora a partir de agora|[2,Inf] %count% horas a partir de agora', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} %count% dia atrás|[2,Inf] %count% dias atrás', 22 | 'future' => '{1} %count% dia a partir de agora|[2,Inf] %count% dias a partir de agora', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} %count% semana atrás|[2,Inf] %count% semanas atrás', 26 | 'future' => '{1} %count% semana a partir de agora|[2,Inf] %count% semanas a partir de agora', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} %count% mês atrás|[2,Inf] %count% meses atrás', 30 | 'future' => '{1} %count% mês a partir de agora|[2,Inf] %count% meses a partir de agora', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} %count% ano atrás|[2,Inf] %count% anos atrás', 34 | 'future' => '{1} %count% ano a partir de agora|[2,Inf] %count% anos a partir de agora', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% segundo|[2,Inf] %count% segundos', 38 | 'minute' => '{1} %count% minuto|[2,Inf] %count% minutos', 39 | 'hour' => '{1} %count% hora|[2,Inf] %count% horas', 40 | 'day' => '{1} %count% dia|[2,Inf] %count% dias', 41 | 'week' => '{1} %count% semana|[2,Inf] %count% semana', 42 | 'month' => '{1} %count% mês|[2,Inf] %count% meses', 43 | 'year' => '{1} %count% ano|[2,Inf] %count% anos', 44 | 'past' => '%value% atrás', 45 | 'future' => '%value% a partir de agora', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.sk.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] práve teraz', 6 | 'future' => '[0,Inf] práve teraz', 7 | ], 8 | 'second' => [ 9 | 'past' => '{1} pred sekundou|[2, 4] pred %count% sekundami|[5,Inf] pred %count% sekundami', 10 | 'future' => '{1} o sekundu|[2, 4] o %count% sekundy|[5,Inf] o %count% sekúnd', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} pred minútou|[2, Inf] pred %count% minútami', 14 | 'future' => '{1} o minútu|[2, 4] o %count% minúty|[5,Inf] o %count% minút', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} pred hodinou|[2, Inf] pred %count% hodinami', 18 | 'future' => '{1} o hodinu|[2, 4] o %count% hodiny|[5,Inf] o %count% hodín', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} včera|[2, Inf] pred %count% dňami', 22 | 'future' => '{1} zajtra|[2, 4] o %count% dni|[5,Inf] o %count% dní', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} minulý týždeň|[2, Inf] pred %count% týždňami', 26 | 'future' => '{1} o týždeň|[2, 4] o %count% týždne|[5,Inf] o %count% týždňov', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} minulý mesiac|[2, Inf] pred %count% mesiacmi', 30 | 'future' => '{1} o mesiac|[2, 4] o %count% mesiace|[5,Inf] o %count% mesiacov', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} minulý rok|[2, Inf] pred %count% rokmi', 34 | 'future' => '{1} za rok|[2, 4] o %count% roky|[5,Inf] o %count% rokov', 35 | ], 36 | 'compound' => [ 37 | 'second' => '{1} %count% sekunda|[2,4] %count% sekundy|[5,Inf] %count% sekúnd', 38 | 'minute' => '{1} %count% minúta|[2,4] %count% minúty|[5,Inf] %count% minút', 39 | 'hour' => '{1} %count% hodina|[2,4] %count% hodiny|[5,Inf] %count% hodín', 40 | 'day' => '{1} %count% deň|[2,4] %count% dni|[5,Inf] %count% dní', 41 | 'week' => '{1} %count% týždeň|[2,4] %count% týždne|[5,Inf] %count% týždňov', 42 | 'month' => '{1} %count% mesiac|[2,4] %count% mesiace|[5,Inf] %count% mesiacov', 43 | 'year' => '{1} %count% rok|[2,4] %count% roky|[5,Inf] %count% rokov', 44 | 'past' => '%value% dozadu', 45 | 'future' => '%value% od teraz', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.fr.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] à l\'instant', 6 | 'future' => '[0,Inf] à l\'instant', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] il y a %count% seconde|[2,Inf] il y a %count% secondes', 10 | 'future' => '[0,1] il y a maintenant %count% seconde|[2,Inf] il y a maintenant %count% secondes', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} il y a %count% minute|[2,Inf] il y a %count% minutes', 14 | 'future' => '{1} il y a maintenant %count% minute|[2,Inf] il y a maintenant %count% minutes', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} il y a %count% heure|[2,Inf] il y a %count% heure', 18 | 'future' => '{1} il y a maintenant %count% heure|[2,Inf] il y a maintenant %count% heures', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} il y a %count% jour|[2,Inf] il y a %count% jours', 22 | 'future' => '{1} il y a maintenant %count% jour|[2,Inf] il y a maintenant %count% jours', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} il y a %count% semaine|[2,Inf] il y a %count% semaines', 26 | 'future' => '{1} il y a maintenant %count% semaine|[2,Inf] il y a maintenant %count% semaines', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} il y a %count% mois|[2,Inf] il y a %count% mois', 30 | 'future' => '{1} %count% mois maintenant|[2,Inf] %count% mois maintenant', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} il y a %count% année|[2,Inf] il y a %count% années', 34 | 'future' => '{1} il y a maintenant %count% année|[2,Inf] il y a maintenant %count% années', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% seconde|[2,Inf] %count% secondes', 38 | 'minute' => '{1} %count% minute|[2,Inf] %count% minutes', 39 | 'hour' => '{1} %count% heure|[2,Inf] %count% heures', 40 | 'day' => '{1} %count% jour|[2,Inf] %count% jours', 41 | 'week' => '{1} %count% semaine|[2,Inf] %count% semaines', 42 | 'month' => '{1} %count% mois|[2,Inf] %count% mois', 43 | 'year' => '{1} %count% année|[2,Inf] %count% années', 44 | 'past' => '%value% il y a', 45 | 'future' => '%value% maintenant', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTimeHumanizer.php: -------------------------------------------------------------------------------- 1 | formatDifference(new Difference($fromDate, $toDate), $locale); 29 | } 30 | 31 | public static function preciseDifference(\DateTimeInterface $fromDate, \DateTimeInterface $toDate, string $locale = 'en') : string 32 | { 33 | $formatter = new PreciseFormatter(Builder::build($locale)); 34 | 35 | return $formatter->formatDifference(new PreciseDifference($fromDate, $toDate), $locale); 36 | } 37 | 38 | public static function timeUnit(Unit $unit, string $locale = 'en') : string 39 | { 40 | $formatter = new Aeon\Calendar\Formatter(Builder::build($locale)); 41 | 42 | return $formatter->timeUnit($unit, $locale); 43 | } 44 | 45 | public static function timePeriod(TimePeriod $timePeriod, string $locale = 'en') : string 46 | { 47 | $formatter = new Formatter(Builder::build($locale)); 48 | 49 | return $formatter->formatDifference(new Difference($timePeriod->start()->toDateTimeImmutable(), $timePeriod->end()->toDateTimeImmutable()), $locale); 50 | } 51 | 52 | public static function timePeriodPrecise(TimePeriod $timePeriod, string $locale = 'en') : string 53 | { 54 | $formatter = new PreciseFormatter(Builder::build($locale)); 55 | 56 | return $formatter->formatDifference(new PreciseDifference($timePeriod->start()->toDateTimeImmutable(), $timePeriod->end()->toDateTimeImmutable()), $locale); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/StringHumanizer.php: -------------------------------------------------------------------------------- 1 | $forbiddenWords 24 | */ 25 | public static function humanize(string $text, bool $capitalize = true, string $separator = '_', array $forbiddenWords = []) : string 26 | { 27 | return (string) new Humanize($text, $capitalize, $separator, $forbiddenWords); 28 | } 29 | 30 | public static function truncate(string $text, int $charactersCount, string $append = '') : string 31 | { 32 | $truncate = new TextTruncate(new WordBreakpoint(), $append); 33 | 34 | return $truncate->truncate($text, $charactersCount); 35 | } 36 | 37 | public static function truncateHtml(string $text, int $charactersCount, string $allowedTags = '', string $append = '') : string 38 | { 39 | $truncate = new HtmlTruncate(new WordBreakpoint(), $allowedTags, $append); 40 | 41 | return $truncate->truncate($text, $charactersCount); 42 | } 43 | 44 | public static function removeShortcodes(string $text) : string 45 | { 46 | if (!\class_exists('\Thunder\Shortcode\Processor\Processor')) { 47 | throw new \RuntimeException('Please add "thunderer/shortcode": ^0.7 to composer.json first'); 48 | } 49 | 50 | $processor = new ShortcodeProcessor(); 51 | 52 | return $processor->removeShortcodes($text); 53 | } 54 | 55 | public static function removeShortcodeTags(string $text) : string 56 | { 57 | if (!\class_exists('\Thunder\Shortcode\Processor\Processor')) { 58 | throw new \RuntimeException('Please add "thunderer/shortcode": ^0.7 to composer.json first'); 59 | } 60 | 61 | $processor = new ShortcodeProcessor(); 62 | 63 | return $processor->removeShortcodeTags($text); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Resources/translations/difference.pl.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'past' => '[0,Inf] w tym momencie', 6 | 'future' => '[0,Inf] w tym momencie', 7 | ], 8 | 'second' => [ 9 | 'past' => '[0,1] sekundę temu|[2, 4] %count% sekundy temu|[5,Inf] %count% sekund temu', 10 | 'future' => '[0,1] za sekundę|[2, 4] za %count% sekund|[5,Inf] za %count% sekund', 11 | ], 12 | 'minute' => [ 13 | 'past' => '{1} minutę temu|[2, 4] %count% minuty temu|[5,Inf] %count% minut temu', 14 | 'future' => '{1} za minutę|[2, 4] za %count% minuty|[5,Inf] za %count% minut', 15 | ], 16 | 'hour' => [ 17 | 'past' => '{1} godzinę temu|[2, 4] %count% godziny temu|[5,Inf] %count% godzin temu', 18 | 'future' => '{1} za godzinę|[2, 4] za %count% godziny|[5,Inf] za %count% godzin', 19 | ], 20 | 'day' => [ 21 | 'past' => '{1} wczoraj|[2, Inf] %count% dni temu', 22 | 'future' => '{1} jutro|[2, Inf] za %count% dni', 23 | ], 24 | 'week' => [ 25 | 'past' => '{1} tydzień temu|[2, 4] %count% tygodnie temu|[5,Inf] %count% tygodni temu', 26 | 'future' => '{1} za tydzień|[2, 4] za %count% tygodnie|[5,Inf] za %count% tygodni', 27 | ], 28 | 'month' => [ 29 | 'past' => '{1} miesiąc temu|[2, 4] %count% miesiące temu|[5,Inf] %count% miesięcy temu', 30 | 'future' => '{1} za miesiąc|[2, 4] za %count% miesiące|[5,Inf] za %count% miesięcy', 31 | ], 32 | 'year' => [ 33 | 'past' => '{1} rok temu|[2, 4] %count% lata temu|[5,Inf] %count% lat temu', 34 | 'future' => '{1} za rok|[2, 4] za %count% lata|[5,Inf] za %count% lat', 35 | ], 36 | 'compound' => [ 37 | 'second' => '[0,1] %count% sekunda|[2,4] %count% sekundy|[5,Inf] %count% sekund', 38 | 'minute' => '{1} %count% minuta|[2,4] %count% minuty|[5,Inf] %count% minut', 39 | 'hour' => '{1} %count% godzina|[2,4] %count% godziny|[5,Inf] %count% godzin', 40 | 'day' => '{1} %count% dzień|[2,Inf] %count% dni', 41 | 'week' => '{1} %count% tydzień|[2,4] %count% tygodnie|[5,Inf] %count% tygodni', 42 | 'month' => '{1} %count% miesiąc|[2,4] %count% miesiące|[5,Inf] %count% miesięcy', 43 | 'year' => '{1} %count% rok|[2,4] %count% lata|[5,Inf] %count% lat', 44 | 'past' => '%value% temu', 45 | 'future' => '%value% od teraz', 46 | ], 47 | ]; 48 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/String/MetricSuffix.php: -------------------------------------------------------------------------------- 1 | 27 | */ 28 | private array $binaryPrefixes = [ 29 | 1_000_000_000_000_000 => '#.##P', 30 | 1_000_000_000_000 => '#.##T', 31 | 1_000_000_000 => '#.##G', 32 | 1_000_000 => '#.##M', 33 | 1000 => '#.#k', 34 | 0 => '#.#', 35 | ]; 36 | 37 | /** 38 | * @param numeric $number 39 | * @param string $locale 40 | * 41 | * @throws \InvalidArgumentException 42 | */ 43 | public function __construct($number, string $locale = 'en') 44 | { 45 | if (!\class_exists(\NumberFormatter::class)) { 46 | throw new \RuntimeException('Metric suffix converter requires intl extension!'); 47 | } 48 | 49 | /** 50 | * @psalm-suppress DocblockTypeContradiction 51 | */ 52 | if (!\is_numeric($number)) { 53 | throw new \InvalidArgumentException('Metric suffix converter accept only numeric values.'); 54 | } 55 | 56 | $this->number = (int) $number; 57 | $this->locale = $locale; 58 | 59 | /* 60 | * Workaround for 32-bit systems which ignore array ordering when 61 | * dropping values over 2^32-1 62 | */ 63 | \krsort($this->binaryPrefixes); 64 | } 65 | 66 | public function convert() : string 67 | { 68 | $formatter = new \NumberFormatter($this->locale, \NumberFormatter::PATTERN_DECIMAL); 69 | 70 | foreach ($this->binaryPrefixes as $size => $unitPattern) { 71 | if ($size <= $this->number) { 72 | $value = ($this->number >= self::CONVERT_THRESHOLD) ? $this->number / (float) $size : $this->number; 73 | $formatter->setPattern($unitPattern); 74 | 75 | /** @phpstan-ignore-next-line */ 76 | return $formatter->format($value); 77 | } 78 | } 79 | 80 | /** @phpstan-ignore-next-line */ 81 | return $formatter->format($this->number); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/DateTime/Difference.php: -------------------------------------------------------------------------------- 1 | fromDate = $fromDate; 39 | $this->toDate = $toDate; 40 | $this->calculate(); 41 | } 42 | 43 | public function getUnit() : Unit 44 | { 45 | return $this->unit; 46 | } 47 | 48 | public function getQuantity() : ?int 49 | { 50 | return $this->quantity; 51 | } 52 | 53 | public function isPast() : bool 54 | { 55 | $diff = $this->toDate->getTimestamp() - $this->fromDate->getTimestamp(); 56 | 57 | return ($diff > 0) ? false : true; 58 | } 59 | 60 | private function calculate() : void 61 | { 62 | /* @var $units Unit[] */ 63 | $units = [ 64 | new Year(), 65 | new Month(), 66 | new Week(), 67 | new Day(), 68 | new Hour(), 69 | new Minute(), 70 | new Second(), 71 | new JustNow(), 72 | ]; 73 | 74 | $absoluteMilliSecondsDiff = \abs($this->toDate->getTimestamp() - $this->fromDate->getTimestamp()) * 1000; 75 | 76 | foreach ($units as $unit) { 77 | if ($absoluteMilliSecondsDiff >= $unit->getMilliseconds()) { 78 | $this->unit = $unit; 79 | 80 | break; 81 | } 82 | } 83 | 84 | $this->quantity = ($absoluteMilliSecondsDiff == 0) 85 | ? $absoluteMilliSecondsDiff 86 | : (int) \round($absoluteMilliSecondsDiff / $this->unit->getMilliseconds()); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/NumberHumanizer.php: -------------------------------------------------------------------------------- 1 | isPrefix()) ? $ordinal . $number : $number . $ordinal; 32 | } 33 | 34 | /** 35 | * @param float|int $number 36 | * @param string $locale 37 | * 38 | * @return string 39 | */ 40 | public static function ordinal($number, string $locale = 'en') : string 41 | { 42 | $ordinal = new Ordinal($number, $locale); 43 | 44 | return (string) $ordinal; 45 | } 46 | 47 | /** 48 | * @param int $number 49 | * @param string $locale 50 | * 51 | * @return bool|int|string 52 | */ 53 | public static function binarySuffix(int $number, string $locale = 'en') 54 | { 55 | $binarySuffix = new BinarySuffix($number, $locale); 56 | 57 | return $binarySuffix->convert(); 58 | } 59 | 60 | /** 61 | * @return bool|int|string 62 | */ 63 | public static function preciseBinarySuffix(int $number, ?int $precision, string $locale = 'en') 64 | { 65 | $binarySuffix = new BinarySuffix($number, $locale, $precision); 66 | 67 | return $binarySuffix->convert(); 68 | } 69 | 70 | /** 71 | * @param numeric $number 72 | */ 73 | public static function metricSuffix($number, string $locale = 'en') : string 74 | { 75 | $binarySuffix = new MetricSuffix($number, $locale); 76 | 77 | return $binarySuffix->convert(); 78 | } 79 | 80 | /** 81 | * @param numeric $number 82 | * 83 | * @return string 84 | */ 85 | public static function toRoman($number) : string 86 | { 87 | $romanNumeral = new RomanNumeral(); 88 | 89 | return $romanNumeral->toRoman($number); 90 | } 91 | 92 | /** 93 | * @return float|int 94 | */ 95 | public static function fromRoman(string $number) 96 | { 97 | $romanNumeral = new RomanNumeral(); 98 | 99 | return $romanNumeral->fromRoman($number); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Number/RomanNumeral.php: -------------------------------------------------------------------------------- 1 | 33 | */ 34 | private array $map = [ 35 | 'M' => 1000, 36 | 'CM' => 900, 37 | 'D' => 500, 38 | 'CD' => 400, 39 | 'C' => 100, 40 | 'XC' => 90, 41 | 'L' => 50, 42 | 'XL' => 40, 43 | 'X' => 10, 44 | 'IX' => 9, 45 | 'V' => 5, 46 | 'IV' => 4, 47 | 'I' => 1, 48 | ]; 49 | 50 | /** 51 | * @param numeric $number 52 | * 53 | * @throws \InvalidArgumentException 54 | * 55 | * @return string 56 | */ 57 | public function toRoman($number) : string 58 | { 59 | if (($number < self::MIN_VALUE) || ($number > self::MAX_VALUE)) { 60 | throw new \InvalidArgumentException(); 61 | } 62 | 63 | $romanString = ''; 64 | 65 | while ($number > 0) { 66 | foreach ($this->map as $key => $value) { 67 | if ($number >= $value) { 68 | $romanString .= $key; 69 | $number -= $value; 70 | 71 | break; 72 | } 73 | } 74 | } 75 | 76 | return $romanString; 77 | } 78 | 79 | /** 80 | * @throws \InvalidArgumentException 81 | * 82 | * @return float|int 83 | */ 84 | public function fromRoman(string $string) 85 | { 86 | if (\mb_strlen($string) === 0 || 0 === \preg_match(self::ROMAN_STRING_MATCHER, $string)) { 87 | throw new \InvalidArgumentException(); 88 | } 89 | 90 | $total = 0; 91 | $i = \mb_strlen($string); 92 | 93 | while ($i > 0) { 94 | $digit = $this->map[$string[--$i]]; 95 | 96 | if ($i > 0) { 97 | $previousDigit = $this->map[$string[$i - 1]]; 98 | 99 | if ($previousDigit < $digit) { 100 | $digit -= $previousDigit; 101 | $i--; 102 | } 103 | } 104 | 105 | $total += $digit; 106 | } 107 | 108 | return $total; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/String/HtmlTruncate.php: -------------------------------------------------------------------------------- 1 | breakpoint = $breakpoint; 25 | $this->append = $append; 26 | $this->allowedTags = $allowedTags; 27 | } 28 | 29 | public function truncate(string $text, int $charactersCount) : string 30 | { 31 | $strippedText = \strip_tags($text, $this->allowedTags); 32 | 33 | return $this->truncateHtml($strippedText, $charactersCount); 34 | } 35 | 36 | /** 37 | * Truncates a string to the given length. It will optionally preserve 38 | * HTML tags if $is_html is set to true. 39 | * 40 | * Adapted from FuelPHP Str::truncate (https://github.com/fuelphp/common/blob/master/src/Str.php) 41 | */ 42 | private function truncateHtml(string $string, int $charactersCount) : string 43 | { 44 | $limit = $charactersCount; 45 | $offset = 0; 46 | $tags = []; 47 | 48 | // Handle special characters. 49 | \preg_match_all('#&[a-z]+;#i', \strip_tags($string), $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); 50 | 51 | foreach ($matches as $match) { 52 | if ($match[0][1] >= $limit) { 53 | break; 54 | } 55 | $limit += (\mb_strlen($match[0][0]) - 1); 56 | } 57 | 58 | // Handle all the html tags. 59 | \preg_match_all('#<[^>]+>([^<]*)#', $string, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); 60 | 61 | foreach ($matches as $match) { 62 | if ($match[0][1] - $offset >= $limit) { 63 | break; 64 | } 65 | 66 | $tag = \mb_substr((string) \strtok($match[0][0], " \t\n\r\0\x0B>"), 1); 67 | 68 | if ($tag[0] != '/') { 69 | $tags[] = $tag; 70 | } elseif (\end($tags) == \mb_substr($tag, 1)) { 71 | \array_pop($tags); 72 | } 73 | 74 | $offset += $match[1][1] - $match[0][1]; 75 | } 76 | 77 | $newString = \mb_substr($string, 0, $limit = \min(\mb_strlen($string), $this->breakpoint->calculatePosition($string, $limit + $offset))); 78 | $newString .= (\mb_strlen($string) > $limit ? $this->append : ''); 79 | $newString .= (\count($tags = \array_reverse($tags)) ? '' : ''); 80 | 81 | return $newString; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Aeon/Calendar/UnitCompound.php: -------------------------------------------------------------------------------- 1 | unit = $timeUnit; 33 | } 34 | 35 | /** 36 | * @return array 37 | */ 38 | public function components() : array 39 | { 40 | if (!\interface_exists('\Aeon\Calendar\Gregorian\Calendar')) { 41 | throw new \RuntimeException('Please add "aeon-php/calendar": ^1.0 to composer.json first'); 42 | } 43 | 44 | $unit = $this->unit; 45 | $compoundResults = []; 46 | 47 | if ($unit instanceof RelativeTimeUnit) { 48 | if ($unit->inYears()) { 49 | $compoundResults[] = new CompoundResult(new Year(), $unit->inYears()); 50 | } 51 | 52 | if ($unit->inCalendarMonths()) { 53 | $compoundResults[] = new CompoundResult(new Month(), $unit->inCalendarMonths()); 54 | } 55 | 56 | return (new DateIntervalCompound($unit->toDateInterval()))->components(); 57 | } 58 | 59 | if ($unit instanceof TimeUnit) { 60 | if ($unit->inDaysAbs() > 0) { 61 | $compoundResults[] = new CompoundResult(new Day(), $unit->inDaysAbs()); 62 | } 63 | 64 | if ($unit->inTimeHours()) { 65 | $compoundResults[] = new CompoundResult(new Hour(), $unit->inTimeHours()); 66 | } 67 | 68 | if ($unit->inTimeMinutes()) { 69 | $compoundResults[] = new CompoundResult(new Minute(), $unit->inTimeMinutes()); 70 | } 71 | 72 | if ($unit->inTimeSeconds() || $unit->inTimeMilliseconds()) { 73 | $seconds = $unit->inTimeSeconds(); 74 | 75 | if ($unit->inTimeMilliseconds() > 0) { 76 | $seconds += $unit->inTimeMilliseconds() / 1000; 77 | } 78 | 79 | $compoundResults[] = new CompoundResult(new Second(), $seconds); 80 | } elseif (!\count($compoundResults)) { 81 | $compoundResults[] = new CompoundResult(new Second(), 0); 82 | } 83 | 84 | return $compoundResults; 85 | } 86 | 87 | throw new \RuntimeException('Unsupported unit type ' . \get_class($unit)); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/Collection/Formatter.php: -------------------------------------------------------------------------------- 1 | translator = $translator; 25 | $this->catalogue = $catalogue; 26 | } 27 | 28 | /** 29 | * @psalm-suppress RedundantCastGivenDocblockType 30 | * 31 | * @param array $collection 32 | */ 33 | public function format(array $collection, ?int $limit = null) : string 34 | { 35 | $count = \count($collection); 36 | 37 | if (0 === $count) { 38 | return ''; 39 | } 40 | 41 | if (1 === $count) { 42 | return (string) $collection[0]; 43 | } 44 | 45 | if (2 === $count) { 46 | return $this->formatOnlyTwo($collection); 47 | } 48 | 49 | if (null !== $limit) { 50 | return $this->formatCommaSeparatedWithLimit($collection, $limit, $count); 51 | } 52 | 53 | return $this->formatCommaSeparated($collection, $count); 54 | } 55 | 56 | /** 57 | * @psalm-suppress RedundantCastGivenDocblockType 58 | * 59 | * @param array $collection 60 | */ 61 | private function formatCommaSeparatedWithLimit(array $collection, ?int $limit, int $count) : string 62 | { 63 | $display = \array_map(fn ($element) => (string) $element, \array_slice($collection, 0, $limit)); 64 | 65 | $moreCount = $count - \count($display); 66 | 67 | return $this->translator->trans('comma_separated_with_limit', [ 68 | '%list%' => \implode(', ', $display), 69 | '%count%' => $moreCount, 70 | ], $this->catalogue); 71 | } 72 | 73 | /** 74 | * @psalm-suppress RedundantCastGivenDocblockType 75 | * 76 | * @param array $collection 77 | */ 78 | private function formatCommaSeparated(array $collection, int $count) : string 79 | { 80 | $display = \array_map(fn ($element) => (string) $element, \array_slice($collection, 0, $count - 1)); 81 | 82 | return $this->translator->trans('comma_separated', [ 83 | '%list%' => \implode(', ', $display), 84 | '%last%' => (string) \end($collection), 85 | ], $this->catalogue); 86 | } 87 | 88 | /** 89 | * @psalm-suppress RedundantCastGivenDocblockType 90 | * 91 | * @param array $collection 92 | */ 93 | private function formatOnlyTwo(array $collection) : string 94 | { 95 | return $this->translator->trans('only_two', [ 96 | '%first%' => (string) $collection[0], 97 | '%second%' => (string) $collection[1], 98 | ], $this->catalogue); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at norbert+coduo@orzechowicz.pl. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /src/Coduo/PHPHumanizer/String/BinarySuffix.php: -------------------------------------------------------------------------------- 1 | 27 | */ 28 | private array $binaryPrefixes = [ 29 | 1_125_899_906_842_624 => '#.## PB', 30 | 1_099_511_627_776 => '#.## TB', 31 | 1_073_741_824 => '#.## GB', 32 | 1_048_576 => '#.## MB', 33 | 1024 => '#.# kB', 34 | 0 => '# bytes', 35 | ]; 36 | 37 | public function __construct(int $number, string $locale = 'en', ?int $precision = null) 38 | { 39 | if (!\class_exists(\NumberFormatter::class)) { 40 | throw new \RuntimeException('Binary suffix converter requires intl extension!'); 41 | } 42 | 43 | if (null !== $precision) { 44 | $this->setSpecificPrecisionFormat($precision); 45 | } 46 | 47 | $this->number = $number; 48 | $this->locale = $locale; 49 | 50 | /* 51 | * Workaround for 32-bit systems which ignore array ordering when 52 | * dropping values over 2^32-1 53 | */ 54 | \krsort($this->binaryPrefixes); 55 | } 56 | 57 | /** 58 | * @return int|string 59 | */ 60 | public function convert() 61 | { 62 | $formatter = new \NumberFormatter($this->locale, \NumberFormatter::PATTERN_DECIMAL); 63 | 64 | if ($this->number < 0) { 65 | return $this->number; 66 | } 67 | 68 | foreach ($this->binaryPrefixes as $size => $unitPattern) { 69 | if ($size <= $this->number) { 70 | $value = ($this->number >= self::CONVERT_THRESHOLD) ? $this->number / (float) $size : $this->number; 71 | $formatter->setPattern($unitPattern); 72 | 73 | /** @phpstan-ignore-next-line */ 74 | return $formatter->format($value); 75 | } 76 | } 77 | 78 | /** @phpstan-ignore-next-line */ 79 | return $formatter->format($this->number); 80 | } 81 | 82 | /** 83 | * Replaces the default ICU 56.1 decimal formats defined in $binaryPrefixes with ones that provide the same symbols 84 | * but the provided number of decimal places. 85 | */ 86 | private function setSpecificPrecisionFormat(int $precision) : void 87 | { 88 | if ($precision < 0) { 89 | throw new \InvalidArgumentException('Precision must be positive'); 90 | } 91 | 92 | if ($precision > 3) { 93 | throw new \InvalidArgumentException('Invalid precision. Binary suffix converter can only represent values in ' . 94 | 'up to three decimal places'); 95 | } 96 | 97 | $icuFormat = '#'; 98 | 99 | if ($precision > 0) { 100 | $icuFormat .= \str_pad('#.', (2 + $precision), '0'); 101 | } 102 | 103 | foreach ($this->binaryPrefixes as $size => $unitPattern) { 104 | if ($size >= 1024) { 105 | $symbol = \substr($unitPattern, (int) \strpos($unitPattern, ' ')); 106 | $this->binaryPrefixes[$size] = $icuFormat . $symbol; 107 | } 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP Humanizer 2 | 3 | [![Tests](https://github.com/coduo/php-humanizer/actions/workflows/tests.yml/badge.svg?branch=5.x)](https://github.com/coduo/php-humanizer/actions/workflows/tests.yml) 4 | [![Latest Stable Version](https://poser.pugx.org/coduo/php-humanizer/v/stable)](https://packagist.org/packages/coduo/php-humanizer) 5 | [![Total Downloads](https://poser.pugx.org/coduo/php-humanizer/downloads)](https://packagist.org/packages/coduo/php-humanizer) 6 | [![Latest Unstable Version](https://poser.pugx.org/coduo/php-humanizer/v/unstable)](https://packagist.org/packages/coduo/php-humanizer) 7 | [![License](https://poser.pugx.org/coduo/php-humanizer/license)](https://packagist.org/packages/coduo/php-humanizer) 8 | 9 | [Readme for 5.x version](https://github.com/coduo/php-humanizer/tree/5.x/README.md) 10 | 11 | 12 | 13 | Humanize values to make them readable for regular people ;) 14 | 15 | # Installation 16 | 17 | Run the following command: 18 | 19 | ```shell 20 | composer require coduo/php-humanizer 21 | ``` 22 | 23 | # Usage 24 | 25 | ## Text 26 | 27 | **Humanize** 28 | 29 | ```php 30 | use Coduo\PHPHumanizer\StringHumanizer; 31 | 32 | StringHumanizer::humanize('field_name'); // "Field Name" 33 | StringHumanizer::humanize('user_id'); // "User id" 34 | StringHumanizer::humanize('field_name', false); // "field name" 35 | ``` 36 | 37 | **Truncate** 38 | 39 | Truncate string to word closest to a certain length 40 | 41 | ```php 42 | use Coduo\PHPHumanizer\StringHumanizer; 43 | 44 | $text = 'Lorem ipsum dolorem si amet, lorem ipsum. Dolorem sic et nunc.'; 45 | 46 | StringHumanizer::truncate($text, 8); // "Lorem ipsum" 47 | StringHumanizer::truncate($text, 8, '...'); // "Lorem ipsum..." 48 | StringHumanizer::truncate($text, 2); // "Lorem" 49 | StringHumanizer::truncate($text, strlen($text)); // "Lorem ipsum dolorem si amet, lorem ipsum. Dolorem sic et nunc." 50 | 51 | ``` 52 | 53 | **Truncate HTML** 54 | 55 | Truncate and HTML string to word closest to a certain length 56 | 57 | ```php 58 | use Coduo\PHPHumanizer\StringHumanizer; 59 | 60 | $text = '

HyperText Markup Language, commonly referred to as HTML, is the standard markup language used to create web pages.[1] Web browsers can read HTML files and render them into visible or audible web pages. HTML describes the structure of a website semantically along with cues for presentation, making it a markup language, rather than a programming language.

'; 61 | 62 | StringHumanizer::truncateHtml($text, 3); // "HyperText" 63 | StringHumanizer::truncateHtml($text, 12, ''); // "HyperText Markup" 64 | StringHumanizer::truncateHtml($text, 50, '', '...'); // "HyperText Markup Language, commonly referred to as..." 65 | StringHumanizer::truncateHtml($text, 75, '', '...'); // 'HyperText Markup Language, commonly referred to as HTML, is the standard markup...' 66 | 67 | ``` 68 | 69 | **Remove shortcodes** 70 | 71 | ```php 72 | $text = 'A text with [short]random[/short] [codes]words[/codes].'; 73 | StringHumanizer::removeShortcodes($text); // "A text with ." 74 | StringHumanizer::removeShortcodeTags($text); // "A text with random words." 75 | ``` 76 | 77 | ## Number 78 | 79 | **Ordinalize** 80 | 81 | ```php 82 | use Coduo\PHPHumanizer\NumberHumanizer; 83 | 84 | NumberHumanizer::ordinalize(0); // "0th" 85 | NumberHumanizer::ordinalize(1); // "1st" 86 | NumberHumanizer::ordinalize(2); // "2nd" 87 | NumberHumanizer::ordinalize(23); // "23rd" 88 | NumberHumanizer::ordinalize(1002, 'nl'); // "1002e" 89 | NumberHumanizer::ordinalize(-111); // "-111th" 90 | 91 | ``` 92 | 93 | **Ordinal** 94 | 95 | ```php 96 | use Coduo\PHPHumanizer\NumberHumanizer; 97 | 98 | NumberHumanizer::ordinal(0); // "th" 99 | NumberHumanizer::ordinal(1); // "st" 100 | NumberHumanizer::ordinal(2); // "nd" 101 | NumberHumanizer::ordinal(23); // "rd" 102 | NumberHumanizer::ordinal(1002); // "nd" 103 | NumberHumanizer::ordinal(-111, 'nl'); // "e" 104 | ``` 105 | 106 | **Roman numbers** 107 | ```php 108 | use Coduo\PHPHumanizer\NumberHumanizer; 109 | 110 | NumberHumanizer::toRoman(1); // "I" 111 | NumberHumanizer::toRoman(5); // "V" 112 | NumberHumanizer::toRoman(1300); // "MCCC" 113 | 114 | NumberHumanizer::fromRoman("MMMCMXCIX"); // 3999 115 | NumberHumanizer::fromRoman("V"); // 5 116 | NumberHumanizer::fromRoman("CXXV"); // 125 117 | ``` 118 | 119 | **Binary Suffix** 120 | 121 | Convert a number of bytes in to the highest applicable data unit 122 | 123 | ```php 124 | use Coduo\PHPHumanizer\NumberHumanizer; 125 | 126 | NumberHumanizer::binarySuffix(0); // "0 bytes" 127 | NumberHumanizer::binarySuffix(1); // "1 bytes" 128 | NumberHumanizer::binarySuffix(1024); // "1 kB" 129 | NumberHumanizer::binarySuffix(1025); // "1 kB" 130 | NumberHumanizer::binarySuffix(1536); // "1.5 kB" 131 | NumberHumanizer::binarySuffix(1048576 * 5); // "5 MB" 132 | NumberHumanizer::binarySuffix(1073741824 * 2); // "2 GB" 133 | NumberHumanizer::binarySuffix(1099511627776 * 3); // "3 TB" 134 | NumberHumanizer::binarySuffix(1325899906842624); // "1.18 PB" 135 | ``` 136 | 137 | Number can be also formatted for specific locale 138 | 139 | ```php 140 | use Coduo\PHPHumanizer\NumberHumanizer; 141 | 142 | NumberHumanizer::binarySuffix(1536, 'pl'); // "1,5 kB" 143 | ``` 144 | 145 | Number can also be humanized with a specific number of decimal places with `preciseBinarySuffix($number, $precision, $locale = 'en')` 146 | The precision parameter must be between 0 and 3. 147 | 148 | ```php 149 | use Coduo\PHPHumanizer\NumberHumanizer; 150 | 151 | NumberHumanizer::preciseBinarySuffix(1024, 2); // "1.00 kB" 152 | NumberHumanizer::preciseBinarySuffix(1325899906842624, 3); // "1.178 PB" 153 | ``` 154 | 155 | This function also supports locale 156 | 157 | ```php 158 | use Coduo\PHPHumanizer\NumberHumanizer; 159 | 160 | NumberHumanizer::preciseBinarySuffix(1325899906842624, 3, 'pl'); // "1,178 PB" 161 | ``` 162 | 163 | **Metric Suffix** 164 | 165 | ```php 166 | use Coduo\PHPHumanizer\NumberHumanizer; 167 | 168 | NumberHumanizer::metricSuffix(-1); // "-1" 169 | NumberHumanizer::metricSuffix(0); // "0" 170 | NumberHumanizer::metricSuffix(1); // "1" 171 | NumberHumanizer::metricSuffix(101); // "101" 172 | NumberHumanizer::metricSuffix(1000); // "1k" 173 | NumberHumanizer::metricSuffix(1240); // "1.2k" 174 | NumberHumanizer::metricSuffix(1240000); // "1.24M" 175 | NumberHumanizer::metricSuffix(3500000); // "3.5M" 176 | ``` 177 | 178 | Number can be also formatted for specific locale 179 | 180 | ```php 181 | use Coduo\PHPHumanizer\NumberHumanizer; 182 | 183 | NumberHumanizer::metricSuffix(1240000, 'pl'); // "1,24M" 184 | ``` 185 | 186 | ## Collections 187 | 188 | **Oxford** 189 | 190 | ```php 191 | use Coduo\PHPHumanizer\CollectionHumanizer; 192 | 193 | CollectionHumanizer::oxford(['Michal', 'Norbert', 'Lukasz', 'Pawel'], 2); // "Michal, Norbert, and 2 others" 194 | CollectionHumanizer::oxford(['Michal', 'Norbert', 'Lukasz'], 2); // "Michal, Norbert, and 1 other" 195 | CollectionHumanizer::oxford(['Michal', 'Norbert']); // "Michal and Norbert" 196 | ``` 197 | 198 | Oxford is using translator component, so you can use whatever string format you like. 199 | 200 | ## Date time 201 | 202 | **Difference** 203 | 204 | ```php 205 | use Coduo\PHPHumanizer\DateTimeHumanizer; 206 | 207 | DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:00:00")); // just now 208 | DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:00:05")); // 5 seconds from now 209 | DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:59:00")); // 1 minute ago 210 | DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:45:00")); // 15 minutes ago 211 | DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:15:00")); // 15 minutes from now 212 | DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 14:00:00")); // 1 hour from now 213 | DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 15:00:00")); // 2 hours from now 214 | DateTimeHumanizer::difference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:00:00")); // 1 hour ago 215 | DateTimeHumanizer::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-25")); // 1 day ago 216 | DateTimeHumanizer::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-24")); // 2 days ago 217 | DateTimeHumanizer::difference(new \DateTime("2014-04-26"), new \DateTime("2014-04-28")); // 2 days from now 218 | DateTimeHumanizer::difference(new \DateTime("2014-04-01"), new \DateTime("2014-04-15")); // 2 weeks from now 219 | DateTimeHumanizer::difference(new \DateTime("2014-04-15"), new \DateTime("2014-04-07")); // 1 week ago 220 | DateTimeHumanizer::difference(new \DateTime("2014-01-01"), new \DateTime("2014-04-01")); // 3 months from now 221 | DateTimeHumanizer::difference(new \DateTime("2014-05-01"), new \DateTime("2014-04-01")); // 1 month ago 222 | DateTimeHumanizer::difference(new \DateTime("2015-05-01"), new \DateTime("2014-04-01")); // 1 year ago 223 | DateTimeHumanizer::difference(new \DateTime("2014-05-01"), new \DateTime("2016-04-01")); // 2 years from now 224 | ``` 225 | 226 | **Precise difference** 227 | 228 | ```php 229 | use Coduo\PHPHumanizer\DateTimeHumanizer; 230 | 231 | DateTimeHumanizer::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-25 11:20:00")); // 1 day, 1 hour, 40 minutes ago 232 | DateTimeHumanizer::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2015-04-28 17:00:00")); // 1 year, 2 days, 4 hours from now 233 | DateTimeHumanizer::preciseDifference(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2016-04-27 13:00:00")); // 2 years, 1 day from now 234 | ``` 235 | 236 | ## Aeon Calendar 237 | 238 | [Aeon PHP](https://aeon-php.org/) is a date&time oriented set of libraries. 239 | 240 | ```php 241 | use Coduo\PHPHumanizer\DateTimeHumanizer; 242 | 243 | $timeUnit = TimeUnit::days(2) 244 | ->add(TimeUnit::hours(3)) 245 | ->add(TimeUnit::minutes(25)) 246 | ->add(TimeUnit::seconds(30)) 247 | ->add(TimeUnit::milliseconds(200)); 248 | 249 | DateTimeHumanizer::timeUnit($timeUnit); // 2 days, 3 hours, 25 minutes, and 30.2 seconds 250 | ``` 251 | 252 | Currently we support following languages: 253 | * [Azerbaijani](src/Coduo/PHPHumanizer/Resources/translations/difference.az.yml) 254 | * [English](src/Coduo/PHPHumanizer/Resources/translations/difference.en.yml) 255 | * [Polish](src/Coduo/PHPHumanizer/Resources/translations/difference.pl.yml) 256 | * [German](src/Coduo/PHPHumanizer/Resources/translations/difference.de.yml) 257 | * [Turkish](src/Coduo/PHPHumanizer/Resources/translations/difference.tr.yml) 258 | * [French](src/Coduo/PHPHumanizer/Resources/translations/difference.fr.yml) 259 | * [Português - Brasil](src/Coduo/PHPHumanizer/Resources/translations/difference.pt_BR.yml) 260 | * [Italian](src/Coduo/PHPHumanizer/Resources/translations/difference.it.yml) 261 | * [Dutch](src/Coduo/PHPHumanizer/Resources/translations/difference.nl.yml) 262 | * [Русский](src/Coduo/PHPHumanizer/Resources/translations/difference.ru.yml) 263 | * [Norwegian](src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml) 264 | * [Afrikaans](src/Coduo/PHPHumanizer/Resources/translations/difference.af.yml) 265 | * [Bulgarian](src/Coduo/PHPHumanizer/Resources/translations/difference.bg.yml) 266 | * [Indonesian](src/Coduo/PHPHumanizer/Resources/translations/difference.id.yml) 267 | * [Chinese Simplified](src/Coduo/PHPHumanizer/Resources/translations/difference.zh_CN.yml) 268 | * [Chinese Taiwan](src/Coduo/PHPHumanizer/Resources/translations/difference.zh_TW.yml) 269 | * [Spanish](src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml) 270 | * [Ukrainian](src/Coduo/PHPHumanizer/Resources/translations/difference.uk.yml) 271 | * [Danish](src/Coduo/PHPHumanizer/Resources/translations/difference.da.yml) 272 | * [Thai](src/Coduo/PHPHumanizer/Resources/translations/difference.th.yml) 273 | * [Japanese](src/Coduo/PHPHumanizer/Resources/translations/difference.ja.yml) 274 | * [Romanian](src/Coduo/PHPHumanizer/Resources/translations/difference.ro.yml) 275 | 276 | # Development 277 | 278 | After downloading library update dependencies: 279 | 280 | ``` 281 | composer update 282 | ``` 283 | 284 | In order to check lowest possible versions of dependencies add 285 | 286 | ``` 287 | composer update --prefer-lowest 288 | ```` 289 | 290 | Execute test suite: 291 | 292 | ``` 293 | composer run test 294 | ``` 295 | 296 | Run CS Fixer 297 | 298 | ``` 299 | composer run cs:php:fix 300 | ``` 301 | 302 | 303 | # Credits 304 | 305 | This lib was inspired by [Java Humanize Lib](https://github.com/mfornos/humanize) && [Rails Active Support](https://github.com/rails/rails/tree/master/activesupport/lib/active_support) 306 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [5.0.3] - 2025-12-11 2 | 3 | ### Added 4 | - [#149](https://github.com/coduo/php-humanizer/pull/149) - **Symfony 8+ support** - [@bpolaszek](https://github.com/bpolaszek) 5 | - [#149](https://github.com/coduo/php-humanizer/pull/149) - **PHP 8.5 support** - [@bpolaszek](https://github.com/bpolaszek) 6 | 7 | ### Changed 8 | - [#141](https://github.com/coduo/php-humanizer/pull/141) - **Update action cache from @v2 to @v4 in Github Action workflows** - [@norberttech](https://github.com/norberttech) 9 | 10 | ### Fixed 11 | - [#149](https://github.com/coduo/php-humanizer/pull/149) - **Incorrect nullable types as of PHP 8.4** - [@bpolaszek](https://github.com/bpolaszek) 12 | - [#139](https://github.com/coduo/php-humanizer/pull/139) - **Readme typo** - [@WatheqAlshowaiter](https://github.com/WatheqAlshowaiter) 13 | 14 | ### Removed 15 | - [#149](https://github.com/coduo/php-humanizer/pull/149) - **Removed `composer.lock` from git and added it to `.gitignore` (lock file not required in packages, helps CI to pass)** - [@bpolaszek](https://github.com/bpolaszek) 16 | 17 | ## [5.0.2] - 2025-02-06 18 | 19 | ### Added 20 | - [#138](https://github.com/coduo/php-humanizer/pull/138) - **Add Swedish translations** - [@adevade](https://github.com/adevade) 21 | 22 | ## [5.0.1] - 2025-01-25 23 | 24 | ### Fixed 25 | - [76e7b6](https://github.com/coduo/php-humanizer/commit/76e7b6a7bec97e095b14e7dbfb7aa19ae1cb7fc9) - **failing tests** - [@norberttech](https://github.com/norberttech) 26 | 27 | ### Updated 28 | - [fb621f](https://github.com/coduo/php-humanizer/commit/fb621fda3e73428af8bba55f697c51daf002580b) - **project to PHP 8.4** - [@norberttech](https://github.com/norberttech) 29 | 30 | ### Removed 31 | - [#136](https://github.com/coduo/php-humanizer/pull/136) - **symfony/yaml dependency** - [@norberttech](https://github.com/norberttech) 32 | 33 | ## [5.0.0] - 2024-04-11 34 | 35 | ### Added 36 | - [#133](https://github.com/coduo/php-humanizer/pull/133) - **Slovak translation added for Oxford and Datetime** - [@jerony-mo](https://github.com/jerony-mo) 37 | - [#133](https://github.com/coduo/php-humanizer/pull/133) - **Czech translation added for Oxford and Datetime** - [@jerony-mo](https://github.com/jerony-mo) 38 | 39 | ### Changed 40 | - [#131](https://github.com/coduo/php-humanizer/pull/131) - **Using the assertSame to make assert equals restricted.** - [@peter279k](https://github.com/peter279k) 41 | 42 | ### Fixed 43 | - [90efee](https://github.com/coduo/php-humanizer/commit/90efee54b12d083d7d4ec62d52cdb7f2a5c9641d) - **development tools dependencies configuration** - [@norberttech](https://github.com/norberttech) 44 | - [fe058c](https://github.com/coduo/php-humanizer/commit/fe058ca2ecb9aa90f8c688a25a9327b7c2050156) - **static analyze github workflow php version** - [@norberttech](https://github.com/norberttech) 45 | - [#132](https://github.com/coduo/php-humanizer/pull/132) - **Fix the CI status badge URL.** - [@peter279k](https://github.com/peter279k) 46 | 47 | ### Updated 48 | - [b18a11](https://github.com/coduo/php-humanizer/commit/b18a11af5c694d8041fe585d687a6d5c4b8f78db) - **README.md** - [@norberttech](https://github.com/norberttech) 49 | - [c5023f](https://github.com/coduo/php-humanizer/commit/c5023fa601eca56a39f23e9a8274d80f4a4a6c6a) - **project to latest versio of php and dependencies** - [@norberttech](https://github.com/norberttech) 50 | 51 | ## [4.0.3] - 2022-06-07 52 | 53 | ### Added 54 | - [#129](https://github.com/coduo/php-humanizer/pull/129) - **support for PHP 8.1 and symfony 6 dependencies** - [@norberttech](https://github.com/norberttech) 55 | 56 | ### Changed 57 | - [57c6ed](https://github.com/coduo/php-humanizer/commit/57c6ed978f48dc810e5e4540cbec022c57fecb3c) - **Delete FUNDING.yml** - [@norberttech](https://github.com/norberttech) 58 | 59 | ### Updated 60 | - [3107e2](https://github.com/coduo/php-humanizer/commit/3107e2b6a568726f4cd40a23847ce1e305c99c95) - **static-analyze.yml** - [@norberttech](https://github.com/norberttech) 61 | - [6a369d](https://github.com/coduo/php-humanizer/commit/6a369d9f17855736c5f38261f6765d084e177da2) - **tests.yml** - [@norberttech](https://github.com/norberttech) 62 | 63 | ## [4.0.2] - 2021-06-20 64 | 65 | ### Changed 66 | - [fb264c](https://github.com/coduo/php-humanizer/commit/fb264c8fbfb94f7a10272ac9fca576d8aa053b4a) - **Aeon Calendar dependency** - [@norberttech](https://github.com/norberttech) 67 | - [#126](https://github.com/coduo/php-humanizer/pull/126) - **Using the `assertTrue` to assert expected is `true`.** - [@peter279k](https://github.com/peter279k) 68 | - [#126](https://github.com/coduo/php-humanizer/pull/126) - **Using the `assertFalse` to assert expected is `false`.** - [@peter279k](https://github.com/peter279k) 69 | 70 | ## [4.0.1] - 2021-02-27 71 | 72 | ### Fixed 73 | - [#125](https://github.com/coduo/php-humanizer/pull/125) - **humanization of time unit less than 1 second** - [@norberttech](https://github.com/norberttech) 74 | 75 | ## [4.0.0] - 2021-02-25 76 | 77 | ### Added 78 | - [0533da](https://github.com/coduo/php-humanizer/commit/0533da67e2a0ff97a8f504ebc8de469eaca150f1) - **more strict php cs fixer rules** - [@norberttech](https://github.com/norberttech) 79 | - [#123](https://github.com/coduo/php-humanizer/pull/123) - **Relative/Time Unit humanizer** - [@norberttech](https://github.com/norberttech) 80 | - [#123](https://github.com/coduo/php-humanizer/pull/123) - **TimePeriod humanizer** - [@norberttech](https://github.com/norberttech) 81 | - [#123](https://github.com/coduo/php-humanizer/pull/123) - **Support for \DateTimeInterface instead of legacy \DateTime in all DateTimeHumanizers** - [@norberttech](https://github.com/norberttech) 82 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **phpstan with highest possible requirements** - [@norberttech](https://github.com/norberttech) 83 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **psalm with highest possible requirements** - [@norberttech](https://github.com/norberttech) 84 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **arguments and return type hinting** - [@norberttech](https://github.com/norberttech) 85 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **PHP 8.0 support** - [@norberttech](https://github.com/norberttech) 86 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **More precise CS fixer rules** - [@norberttech](https://github.com/norberttech) 87 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **Full change log** - [@norberttech](https://github.com/norberttech) 88 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **integration with aeon-php/automation** - [@norberttech](https://github.com/norberttech) 89 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **Github actions integration** - [@norberttech](https://github.com/norberttech) 90 | - [#120](https://github.com/coduo/php-humanizer/pull/120) - **test for azerbaijani language** - [@4t87ux8](https://github.com/4t87ux8) 91 | - [#119](https://github.com/coduo/php-humanizer/pull/119) - **support azerbaijani language** - [@4t87ux8](https://github.com/4t87ux8) 92 | 93 | ### Changed 94 | - [#124](https://github.com/coduo/php-humanizer/pull/124) - **load Translator only once for given locale** - [@norberttech](https://github.com/norberttech) 95 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **minimum required PHP version ^7.4** - [@norberttech](https://github.com/norberttech) 96 | - [#118](https://github.com/coduo/php-humanizer/pull/118) - **create azerbaijani translation** - [@4t87ux8](https://github.com/4t87ux8) 97 | - [fa52e6](https://github.com/coduo/php-humanizer/commit/fa52e6223eef2f19fbd0a290432b5a878317dca2) - **Fixxed issue with symfony translator dependency, upgraded php, phpunit and phpspec dependencies** - [@norberttech](https://github.com/norberttech) 98 | - [f989a9](https://github.com/coduo/php-humanizer/commit/f989a91d2d90f5d4bf4922ab9fec1674e7fe024e) - **Create FUNDING.yml** - [@norberttech](https://github.com/norberttech) 99 | - [142689](https://github.com/coduo/php-humanizer/commit/142689763a6aafdd9f1dfbb48db9807bbe027acc) - **Update README.md** - [@norberttech](https://github.com/norberttech) 100 | - [6255e0](https://github.com/coduo/php-humanizer/commit/6255e022c0ff8767cae6cdb4552d13f5f0df0d65) - **Moved php-cs-fixer to dev dependency where it belongs to** - [@norberttech](https://github.com/norberttech) 101 | - [4d62db](https://github.com/coduo/php-humanizer/commit/4d62dba187d89bc8276ff6e5364d2dd9a3f2ad5f) - **Migrated from travis-ci.org to travis-ci.com** - [@norberttech](https://github.com/norberttech) 102 | - [dc528e](https://github.com/coduo/php-humanizer/commit/dc528ebcef31b793e1dd24dbe90f14039361fad1) - **Update README.md** - [@norberttech](https://github.com/norberttech) 103 | - [1b2787](https://github.com/coduo/php-humanizer/commit/1b2787d28282247b3fe68cd5b9f6bf80f304fa63) - **dev-master branch aliast** - [@norberttech](https://github.com/norberttech) 104 | 105 | ### Fixed 106 | - [16074f](https://github.com/coduo/php-humanizer/commit/16074feea40f8d96e2a31d8d18e24425149a6086) - **missing .php_cs configuration file** - [@norberttech](https://github.com/norberttech) 107 | - [4de08d](https://github.com/coduo/php-humanizer/commit/4de08de0b2463cfc498612a89189385b5de4f66d) - **updating changelog workflow** - [@norberttech](https://github.com/norberttech) 108 | - [fc3a04](https://github.com/coduo/php-humanizer/commit/fc3a043f6e03bc29e86d0cd58ae3a6b7daf40d69) - **travis configuration** - [@norberttech](https://github.com/norberttech) 109 | - [#115](https://github.com/coduo/php-humanizer/pull/115) - **composer autoloading deprecation notice; Support symfony 5** - [@brianwozeniak](https://github.com/brianwozeniak) 110 | 111 | ### Removed 112 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **phpspec** - [@norberttech](https://github.com/norberttech) 113 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **symfony/config dependency** - [@norberttech](https://github.com/norberttech) 114 | - [#122](https://github.com/coduo/php-humanizer/pull/122) - **travis CI integration** - [@norberttech](https://github.com/norberttech) 115 | - [83a180](https://github.com/coduo/php-humanizer/commit/83a1805da9a28a98a0bb932a5236becd44ea79b6) - **php 8.0 from matrix** - [@norberttech](https://github.com/norberttech) 116 | 117 | ## [3.0.2] - 2019-04-29 118 | 119 | ### Changed 120 | - [9d83e5](https://github.com/coduo/php-humanizer/commit/9d83e509dacfd26250ee4c6b0f195affb08cb1e2) - **Moved php-cs-fixer to dev dependency where it belongs to** - [@norberttech](https://github.com/norberttech) 121 | 122 | ## [3.0.1] - 2019-04-20 123 | 124 | ### Changed 125 | - [380428](https://github.com/coduo/php-humanizer/commit/38042820e9ee7ccc76d66f9c480fe8b7f0e8aaf0) - **Update README.md** - [@norberttech](https://github.com/norberttech) 126 | 127 | ## [3.0.0] - 2019-04-20 128 | 129 | ### Added 130 | - [17a5ab](https://github.com/coduo/php-humanizer/commit/17a5ab5243ae1eec2e3d39388bf611088b8fd5e7) - **missing translations** - [@norberttech](https://github.com/norberttech) 131 | - [#86](https://github.com/coduo/php-humanizer/pull/86) - **test case with 0 at the end of the number** - [@norberttech](https://github.com/norberttech) 132 | - [#84](https://github.com/coduo/php-humanizer/pull/84) - **PFIGS ordinals** - [@martinbutt](https://github.com/martinbutt) 133 | 134 | ### Changed 135 | - [1b2787](https://github.com/coduo/php-humanizer/commit/1b2787d28282247b3fe68cd5b9f6bf80f304fa63) - **dev-master branch aliast** - [@norberttech](https://github.com/norberttech) 136 | - [14ab74](https://github.com/coduo/php-humanizer/commit/14ab746762acd1856ddd386023128f23935ef119) - **CS Fixes** - [@norberttech](https://github.com/norberttech) 137 | - [9edceb](https://github.com/coduo/php-humanizer/commit/9edceb2d21fa879e91072308b8bbe3503a346bd2) - **CS Fixes** - [@norberttech](https://github.com/norberttech) 138 | - [#112](https://github.com/coduo/php-humanizer/pull/112) - **Upgraded thunderer/shortcode dependency to ^0.7** - [@thunderer](https://github.com/thunderer) 139 | - [#111](https://github.com/coduo/php-humanizer/pull/111) - **Allow later versions of symfony packages** - [@brianwozeniak](https://github.com/brianwozeniak) 140 | - [#91](https://github.com/coduo/php-humanizer/pull/91) - **Sanity check for NumberFormatter when intl is not installed** - [@thunderer](https://github.com/thunderer) 141 | - [#40](https://github.com/coduo/php-humanizer/pull/40) - **Romanian translations** - [@a-ungurianu](https://github.com/a-ungurianu) 142 | - [#106](https://github.com/coduo/php-humanizer/pull/106) - **[master] Add translation: zh_TW** - [@jfcherng](https://github.com/jfcherng) 143 | - [#104](https://github.com/coduo/php-humanizer/pull/104) - **Feature/update** - [@norberttech](https://github.com/norberttech) 144 | - [#89](https://github.com/coduo/php-humanizer/pull/89) - **remove unnecessary echo** - [@vinicius73](https://github.com/vinicius73) 145 | - [#87](https://github.com/coduo/php-humanizer/pull/87) - **Force $binaryPrefixes array ordering on 32-bit systems, fixes #83** - [@Forst](https://github.com/Forst) 146 | - [5cd850](https://github.com/coduo/php-humanizer/commit/5cd850b49b1ca30811f24c5c1a9b0d6e4cac9fba) - **Update composer.json** - [@norberttech](https://github.com/norberttech) 147 | - [#85](https://github.com/coduo/php-humanizer/pull/85) - **Support Japanese language** - [@serima](https://github.com/serima) 148 | 149 | ### Fixed 150 | - [9b52c5](https://github.com/coduo/php-humanizer/commit/9b52c5dc42f10ff60f4827ff9a736b3a1a18f0e4) - **README.md** - [@norberttech](https://github.com/norberttech) 151 | - [#80](https://github.com/coduo/php-humanizer/pull/80) - **russian translation** - [@dizzy7](https://github.com/dizzy7) 152 | 153 | ## [2.0.1] - 2019-02-25 154 | 155 | ### Changed 156 | - [#107](https://github.com/coduo/php-humanizer/pull/107) - **[2.0] Add translation: zh_TW** - [@jfcherng](https://github.com/jfcherng) 157 | 158 | ### Fixed 159 | - [#108](https://github.com/coduo/php-humanizer/pull/108) - **travis configuration for 2.0 branch** - [@norberttech](https://github.com/norberttech) 160 | 161 | ## [2.0.0-beta] - 2016-02-21 162 | 163 | ### Added 164 | - [#78](https://github.com/coduo/php-humanizer/pull/78) - **ext-inl to composer suggest** - [@norberttech](https://github.com/norberttech) 165 | - [#68](https://github.com/coduo/php-humanizer/pull/68) - **composer cache folder and move to new infrastructure** - [@norberttech](https://github.com/norberttech) 166 | 167 | ### Changed 168 | - [e85d69](https://github.com/coduo/php-humanizer/commit/e85d6905a097f9ba6b2165d9998749eb113d0289) - **Merge pull request #78 from norzechowicz/suggest-intl** - [@norzechowicz](https://github.com/norzechowicz) 169 | - [#75](https://github.com/coduo/php-humanizer/pull/75) - **Cleanup before stable release** - [@norberttech](https://github.com/norberttech) 170 | - [f5831e](https://github.com/coduo/php-humanizer/commit/f5831e3be54ca85c9fc14ee5da00b2d6ba1143bb) - **Merge pull request #75 from norzechowicz/cleanup** - [@norzechowicz](https://github.com/norzechowicz) 171 | - [#73](https://github.com/coduo/php-humanizer/pull/73) - **improve strategy to handle prefix-ordinal** - [@isnani](https://github.com/isnani) 172 | - [6ec963](https://github.com/coduo/php-humanizer/commit/6ec963fb1c8ecee66feb0228ca5626f1c1ca09f8) - **Merge pull request #73 from isnani/improve-ordinal-strategy** - [@norzechowicz](https://github.com/norzechowicz) 173 | - [#70](https://github.com/coduo/php-humanizer/pull/70) - **Cleanup** - [@norberttech](https://github.com/norberttech) 174 | - [dac4b4](https://github.com/coduo/php-humanizer/commit/dac4b43390f320b82728f1e5e0ad45f7c68d591e) - **Merge pull request #70 from norzechowicz/cleanup** - [@norzechowicz](https://github.com/norzechowicz) 175 | - [#69](https://github.com/coduo/php-humanizer/pull/69) - **Renamed all facades in order to support php7** - [@norberttech](https://github.com/norberttech) 176 | - [b7214c](https://github.com/coduo/php-humanizer/commit/b7214ce3e0511d5172568aff4a4572a0d80762a1) - **Merge pull request #69 from norzechowicz/php7-support** - [@norzechowicz](https://github.com/norzechowicz) 177 | - [3f252e](https://github.com/coduo/php-humanizer/commit/3f252ef1a717a841dac1316f835494ef82104cde) - **master branch alias** - [@norberttech](https://github.com/norberttech) 178 | - [ae6020](https://github.com/coduo/php-humanizer/commit/ae602062f4500488dcbd119b3560a1bdd4fe2699) - **Merge pull request #68 from norzechowicz/travis-ci** - [@norzechowicz](https://github.com/norzechowicz) 179 | - [7c7e79](https://github.com/coduo/php-humanizer/commit/7c7e79dabc0989dbaf485d46c00d9d836c929f8a) - **Merge pull request #67 from nwatth/thai-translation** - [@norzechowicz](https://github.com/norzechowicz) 180 | - [#67](https://github.com/coduo/php-humanizer/pull/67) - **Thai translation** - [@nwatth](https://github.com/nwatth) 181 | 182 | ## [1.0.9] - 2015-12-02 183 | 184 | ### Added 185 | - [#54](https://github.com/coduo/php-humanizer/pull/54) - **Ukrainian to the list of languages** - [@Borales](https://github.com/Borales) 186 | - [d2904a](https://github.com/coduo/php-humanizer/commit/d2904ae1e1ebd79c7b8224aa31bd5aec8d9575a4) - **composer.phar into .gitignore** - [@norberttech](https://github.com/norberttech) 187 | - [#26](https://github.com/coduo/php-humanizer/pull/26) - **Spanish translation.** - [@orestes](https://github.com/orestes) 188 | - [#53](https://github.com/coduo/php-humanizer/pull/53) - **Chinese Simplified (zh_CN)** - [@arrowrowe](https://github.com/arrowrowe) 189 | 190 | ### Changed 191 | - [#65](https://github.com/coduo/php-humanizer/pull/65) - **Oxford french translation** - [@percymamedy](https://github.com/percymamedy) 192 | - [b36457](https://github.com/coduo/php-humanizer/commit/b364572a7a73bed0be62a7d2df382fb1ab35cd2a) - **Merge pull request #65 from percymamedy/master** - [@norzechowicz](https://github.com/norzechowicz) 193 | - [#66](https://github.com/coduo/php-humanizer/pull/66) - **Danish translation** - [@hyperpanic](https://github.com/hyperpanic) 194 | - [7599dd](https://github.com/coduo/php-humanizer/commit/7599dd847f6b72c6c41f9458cfd92092200644e9) - **Merge pull request #66 from radiosignal/danish-translation** - [@norzechowicz](https://github.com/norzechowicz) 195 | - [#61](https://github.com/coduo/php-humanizer/pull/61) - **Shortcode removal utilities** - [@thunderer](https://github.com/thunderer) 196 | - [6bed68](https://github.com/coduo/php-humanizer/commit/6bed6804a97b0489af80ea229616d26a7224b33a) - **Merge pull request #61 from thunderer/string-shortcode-removal** - [@norzechowicz](https://github.com/norzechowicz) 197 | - [a78a55](https://github.com/coduo/php-humanizer/commit/a78a552671dc51f4393b2806097250d0163eee2f) - **Merge pull request #64 from ddmler/master** - [@norzechowicz](https://github.com/norzechowicz) 198 | - [#64](https://github.com/coduo/php-humanizer/pull/64) - **German translation** - [@ddmler](https://github.com/ddmler) 199 | - [3eb227](https://github.com/coduo/php-humanizer/commit/3eb227e710726d04b1905dfc2422370d716611d5) - **Merge pull request #46 from doenietzomoeilijk/master** - [@norzechowicz](https://github.com/norzechowicz) 200 | - [#46](https://github.com/coduo/php-humanizer/pull/46) - **Refactor Number into separate languages** - [@doenietzomoeilijk](https://github.com/doenietzomoeilijk) 201 | - [a68dc7](https://github.com/coduo/php-humanizer/commit/a68dc7326b1991161e423812d454bf51f4c15d5e) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz) 202 | - [3bcb4b](https://github.com/coduo/php-humanizer/commit/3bcb4b6c204a1d042517bb93e39f45cef1fe8615) - **Merge pull request #54 from Borales/master** - [@norzechowicz](https://github.com/norzechowicz) 203 | - [#58](https://github.com/coduo/php-humanizer/pull/58) - **Remove composer.phar file** - [@vinkla](https://github.com/vinkla) 204 | - [216c9b](https://github.com/coduo/php-humanizer/commit/216c9bbd1f173213a5137306faf5a8a04cab315e) - **Merge pull request #55 from hjason/master** - [@norzechowicz](https://github.com/norzechowicz) 205 | - [5c9bb3](https://github.com/coduo/php-humanizer/commit/5c9bb3393a682126bb8d2d51fcdc77476eef2b83) - **Merge pull request #26 from orestes/es-translation** - [@norzechowicz](https://github.com/norzechowicz) 206 | - [34ef53](https://github.com/coduo/php-humanizer/commit/34ef53fbd42ee7d33999ca4896ea17c2a1cc8a30) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz) 207 | - [51ea67](https://github.com/coduo/php-humanizer/commit/51ea6720069d822a9b9ef8797d708b7205123517) - **Merge pull request #53 from dyweb/master** - [@norzechowicz](https://github.com/norzechowicz) 208 | 209 | ### Fixed 210 | - [73e99d](https://github.com/coduo/php-humanizer/commit/73e99d096f9f1bc4f66fbb13fc0a3a6f620f4eea) - **StringTest** - [@hjason2042@gmail.com](#) 211 | 212 | ## [1.0.8] - 2015-11-06 213 | 214 | ### Added 215 | - [#52](https://github.com/coduo/php-humanizer/pull/52) - **Indonesian language** - [@naprirfan](https://github.com/naprirfan) 216 | - [#41](https://github.com/coduo/php-humanizer/pull/41) - **russian. Add prefix at format difference.** - [@sam002](https://github.com/sam002) 217 | - [#51](https://github.com/coduo/php-humanizer/pull/51) - **possibility to pass forbidden words into humanizer** - [@norberttech](https://github.com/norberttech) 218 | - [#49](https://github.com/coduo/php-humanizer/pull/49) - **support for multiple character separators at string humanizer** - [@drgomesp](https://github.com/drgomesp) 219 | - [#27](https://github.com/coduo/php-humanizer/pull/27) - **Bulgarian translation** - [@lpopov](https://github.com/lpopov) 220 | - [f65309](https://github.com/coduo/php-humanizer/commit/f6530941c4fb5c109aa593229a3ea3da449b6781) - **the breakpoint in the constructor** - [@smeeckaert](https://github.com/smeeckaert) 221 | - [798d77](https://github.com/coduo/php-humanizer/commit/798d77d6b864b2d46b4c2487f616ea044f08f92c) - **breakpoint tests** - [@smeeckaert](https://github.com/smeeckaert) 222 | - [#38](https://github.com/coduo/php-humanizer/pull/38) - **Dutch Oxford translations.** - [@doenietzomoeilijk](https://github.com/doenietzomoeilijk) 223 | - [#29](https://github.com/coduo/php-humanizer/pull/29) - **Norwegian translation** - [@dagaa](https://github.com/dagaa) 224 | - [#16](https://github.com/coduo/php-humanizer/pull/16) - **Dutch translation.** - [@Ozmodiar](https://github.com/Ozmodiar) 225 | 226 | ### Changed 227 | - [d6e784](https://github.com/coduo/php-humanizer/commit/d6e784a86b6f2318394fd6b8af853e5180d3ab15) - **Merge pull request #52 from naprirfan/master** - [@norzechowicz](https://github.com/norzechowicz) 228 | - [9d1732](https://github.com/coduo/php-humanizer/commit/9d17321e4259ff8376d5a779c0ad682b4394ae00) - **Merge pull request #47 from mostertb/master** - [@norzechowicz](https://github.com/norzechowicz) 229 | - [#47](https://github.com/coduo/php-humanizer/pull/47) - **Support for optional explicit BinarySuffix precision** - [@mostertb](https://github.com/mostertb) 230 | - [a4d68a](https://github.com/coduo/php-humanizer/commit/a4d68a956478bfe84661ca1f8a6c8984aaba741c) - **Merge pull request #41 from sam002/master** - [@norzechowicz](https://github.com/norzechowicz) 231 | - [#30](https://github.com/coduo/php-humanizer/pull/30) - **TruncateHtml** - [@smeeckaert](https://github.com/smeeckaert) 232 | - [0465bd](https://github.com/coduo/php-humanizer/commit/0465bd058e9b8c26bf9dc00f38fe14a8473f67b7) - **Merge branch 'master' of git://github.com/smeeckaert/php-humanizer into smeeckaert-master** - [@norberttech](https://github.com/norberttech) 233 | - [4a6ed1](https://github.com/coduo/php-humanizer/commit/4a6ed1f15345562df1eede367112d06a9fc41ab3) - **Merge pull request #51 from norzechowicz/humanizer-forbidden-words** - [@norzechowicz](https://github.com/norzechowicz) 234 | - [c0606e](https://github.com/coduo/php-humanizer/commit/c0606e6844a22bc5480a2527d2f043d6a52eb52a) - **Merge pull request #50 from norzechowicz/phpunit** - [@norzechowicz](https://github.com/norzechowicz) 235 | - [#50](https://github.com/coduo/php-humanizer/pull/50) - **Moved integration tests from phpspec into phpunit** - [@norberttech](https://github.com/norberttech) 236 | - [0a04e0](https://github.com/coduo/php-humanizer/commit/0a04e02fbf7ba37a2df8b4c3a5f0b93d0ce9f002) - **Merge pull request #49 from drgomesp/support-multiple-character-separator** - [@norzechowicz](https://github.com/norzechowicz) 237 | - [fe8f03](https://github.com/coduo/php-humanizer/commit/fe8f03731d1349fb24df7eb3d16eeda0b5d6f633) - **Merge pull request #27 from lpopov/master** - [@norzechowicz](https://github.com/norzechowicz) 238 | - [#44](https://github.com/coduo/php-humanizer/pull/44) - **[ADD] Support PSR-4 Composer** - [@Th3Mouk](https://github.com/Th3Mouk) 239 | - [75825a](https://github.com/coduo/php-humanizer/commit/75825a8ca318a3d7c523d3d489dd0547ab6a6b23) - **Merge pull request #44 from Th3Mouk/patch-1** - [@norzechowicz](https://github.com/norzechowicz) 240 | - [#42](https://github.com/coduo/php-humanizer/pull/42) - **Fixes a typo in French** - [@Gnomino](https://github.com/Gnomino) 241 | - [5bbff0](https://github.com/coduo/php-humanizer/commit/5bbff03cebefdf95eaa4cf9c53905c703a471ae4) - **style** - [@smeeckaert](https://github.com/smeeckaert) 242 | - [cc7a56](https://github.com/coduo/php-humanizer/commit/cc7a56a09f31a50bf32a329dea7b65c446e53631) - **refacto truncate** - [@smeeckaert](https://github.com/smeeckaert) 243 | - [a7cb87](https://github.com/coduo/php-humanizer/commit/a7cb8781189fb13d078530a03111bef47af8d04e) - **rename breakpoint len** - [@smeeckaert](https://github.com/smeeckaert) 244 | - [91d107](https://github.com/coduo/php-humanizer/commit/91d1079d1f6eb88ec784d66e71c88da459ae6e37) - **code style** - [@smeeckaert](https://github.com/smeeckaert) 245 | - [dac446](https://github.com/coduo/php-humanizer/commit/dac446bb4bb0a959fb39466b3729bc97060f4449) - **refacto visibility and breakpoint** - [@smeeckaert](https://github.com/smeeckaert) 246 | - [#34](https://github.com/coduo/php-humanizer/pull/34) - **string functions into multibyte string functions** - [@norberttech](https://github.com/norberttech) 247 | - [#35](https://github.com/coduo/php-humanizer/pull/35) - **Oxford italian translations** - [@omissis](https://github.com/omissis) 248 | - [#22](https://github.com/coduo/php-humanizer/pull/22) - **Oxford collection + phpcs fixer cleanup.** - [@defrag](https://github.com/defrag) 249 | - [#33](https://github.com/coduo/php-humanizer/pull/33) - **Truncate check length of append** - [@smeeckaert](https://github.com/smeeckaert) 250 | - [#31](https://github.com/coduo/php-humanizer/pull/31) - **Addition of Portuguese (pt) language translation (with spec tests)** - [@lightglitch](https://github.com/lightglitch) 251 | - [8cdeae](https://github.com/coduo/php-humanizer/commit/8cdeaef54f759d7e9a93c85cbf9e6e7b63dd6e76) - **truncate html** - [@smeeckaert](https://github.com/smeeckaert) 252 | - [#28](https://github.com/coduo/php-humanizer/pull/28) - **Addition of Afrikaans (af) language translation (with spec tests)** - [@sarelvdwalt](https://github.com/sarelvdwalt) 253 | - [#21](https://github.com/coduo/php-humanizer/pull/21) - **More correct wording for Dutch version of "... from now".** - [@Ozmodiar](https://github.com/Ozmodiar) 254 | - [1f9243](https://github.com/coduo/php-humanizer/commit/1f924384c5f7b8bfbced89debac2b67b78511f7a) - **Merge pull request #21 from Ozmodiar/nl-translation** - [@norzechowicz](https://github.com/norzechowicz) 255 | - [f5dafa](https://github.com/coduo/php-humanizer/commit/f5dafa6e721f93306496d3207e646a60c5bb4283) - **Merge pull request #18 from mattallty/patch-1** - [@norzechowicz](https://github.com/norzechowicz) 256 | - [120f11](https://github.com/coduo/php-humanizer/commit/120f118c7051bdde9e9ea1d442cce6a70dfea8d9) - **Merge pull request #19 from NoUseFreak/composer_install** - [@norzechowicz](https://github.com/norzechowicz) 257 | - [#19](https://github.com/coduo/php-humanizer/pull/19) - **Update composer installation instructions.** - [@NoUseFreak](https://github.com/NoUseFreak) 258 | - [158714](https://github.com/coduo/php-humanizer/commit/1587145004b2f97b0562d359ef7c6d46e96295de) - **Merge pull request #16 from Ozmodiar/nl-translation** - [@norzechowicz](https://github.com/norzechowicz) 259 | - [e49510](https://github.com/coduo/php-humanizer/commit/e49510dfd6e381489cfc5976b5683dba5d5e73da) - **Merge pull request #17 from Ozmodiar/readme-parenthesis** - [@norzechowicz](https://github.com/norzechowicz) 260 | 261 | ### Fixed 262 | - [3c3b83](https://github.com/coduo/php-humanizer/commit/3c3b830fad0f6e436a08b3f1adf20334a6a77604) - **doc** - [@smeeckaert](https://github.com/smeeckaert) 263 | - [#18](https://github.com/coduo/php-humanizer/pull/18) - **typo in french translation** - [@mattallty](https://github.com/mattallty) 264 | - [#17](https://github.com/coduo/php-humanizer/pull/17) - **parenthesis.** - [@Ozmodiar](https://github.com/Ozmodiar) 265 | 266 | ## [1.0.7] - 2015-10-26 267 | 268 | ### Added 269 | - [#15](https://github.com/coduo/php-humanizer/pull/15) - **spec for Italian translations** - [@norberttech](https://github.com/norberttech) 270 | - [#14](https://github.com/coduo/php-humanizer/pull/14) - **italian translations.** - [@omissis](https://github.com/omissis) 271 | 272 | ### Changed 273 | - [a23b8e](https://github.com/coduo/php-humanizer/commit/a23b8e5b32a1b41e8e0d653a2de77ca090f47f8d) - **Merge pull request #15 from norzechowicz/italian-translations-spec** - [@norzechowicz](https://github.com/norzechowicz) 274 | - [0db6f5](https://github.com/coduo/php-humanizer/commit/0db6f5d73b46bf8864b3dfc4823b29aeb97dd326) - **Merge pull request #14 from omissis/italian-translations** - [@norzechowicz](https://github.com/norzechowicz) 275 | - [d05a54](https://github.com/coduo/php-humanizer/commit/d05a5494266fe5bc13e64aaa3c85cb58919fc63f) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz) 276 | 277 | ## [1.0.6] - 2015-10-26 278 | 279 | ### Changed 280 | - [8d7fff](https://github.com/coduo/php-humanizer/commit/8d7fff6382f60b278ddb069d9088d9d35ce26540) - **Rename difference.pt_br.yml to difference.pt_BR.yml** - [@norzechowicz](https://github.com/norzechowicz) 281 | 282 | ## [1.0.4] - 2015-10-26 283 | 284 | ### Added 285 | - [#10](https://github.com/coduo/php-humanizer/pull/10) - **translation for Portuguese - Brazil** - [@IgorDePaula](https://github.com/IgorDePaula) 286 | - [c6a594](https://github.com/coduo/php-humanizer/commit/c6a594a57ea3687cb199183b56a232761a81f736) - **specs for FR translations** - [@norberttech](https://github.com/norberttech) 287 | 288 | ### Changed 289 | - [6051e8](https://github.com/coduo/php-humanizer/commit/6051e89f3bacd816dced8b3d1cb3a07c1b9b0336) - **Merge pull request #12 from marcamon2013/master** - [@norzechowicz](https://github.com/norzechowicz) 290 | - [#12](https://github.com/coduo/php-humanizer/pull/12) - **Translation file added** - [@jebog](https://github.com/jebog) 291 | - [#13](https://github.com/coduo/php-humanizer/pull/13) - **create turkish translation** - [@cnkt](https://github.com/cnkt) 292 | - [e007db](https://github.com/coduo/php-humanizer/commit/e007dbcccdf56ae2021f13b300f78e2fca628d5b) - **Merge pull request #13 from cnkt/master** - [@norzechowicz](https://github.com/norzechowicz) 293 | 294 | ### Fixed 295 | - [8754ad](https://github.com/coduo/php-humanizer/commit/8754ad1f0e680d547c4197cc48d13d7f0b6ab766) - **Translator Builder regexp, added spec and updated readme for pt_BR translation** - [@norberttech](https://github.com/norberttech) 296 | - [38bc22](https://github.com/coduo/php-humanizer/commit/38bc22377a66d24d3ebda915afa09e83cf3d8581) - **typo in TR translations and added spec** - [@norberttech](https://github.com/norberttech) 297 | 298 | ## [1.0.3] - 2015-10-24 299 | 300 | ### Added 301 | - [9c6a59](https://github.com/coduo/php-humanizer/commit/9c6a59981ca6902644c7c35c8deea1cbc994d7c7) - **German locale specs** - [@norberttech](https://github.com/norberttech) 302 | 303 | ### Changed 304 | - [a91217](https://github.com/coduo/php-humanizer/commit/a91217819c7c1d3a0f6a41182784b98681cb6f83) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz) 305 | - [c227c3](https://github.com/coduo/php-humanizer/commit/c227c3bfe343ce8322daee67bfb8116add20af1e) - **Rename difference-de.yml to difference.de.yml** - [@norzechowicz](https://github.com/norzechowicz) 306 | 307 | ## [1.0.2] - 2015-10-24 308 | 309 | ### Added 310 | - [#11](https://github.com/coduo/php-humanizer/pull/11) - **german translation** - [@tbreuss](https://github.com/tbreuss) 311 | 312 | ### Changed 313 | - [9cb14a](https://github.com/coduo/php-humanizer/commit/9cb14aa8c77d6dc6aaff87770680251c993c0b79) - **Merge pull request #11 from tbreuss/master** - [@norzechowicz](https://github.com/norzechowicz) 314 | 315 | ## [1.0.1] - 2015-07-14 316 | 317 | ### Changed 318 | - [#9](https://github.com/coduo/php-humanizer/pull/9) - **Test lowest version of dependencies** - [@norberttech](https://github.com/norberttech) 319 | - [97fee0](https://github.com/coduo/php-humanizer/commit/97fee0dbe7999c4305a3de686f9fdc6b3502796e) - **Merge pull request #9 from norzechowicz/test-lowest-dependencies** - [@norzechowicz](https://github.com/norzechowicz) 320 | - [d97917](https://github.com/coduo/php-humanizer/commit/d979178d45d631d9acd98394b90be3ff345c8c02) - **Update README.md** - [@defrag](https://github.com/defrag) 321 | - [80500c](https://github.com/coduo/php-humanizer/commit/80500c5c50e45f0346af394e3031307923d59b5f) - **Update README.md** - [@defrag](https://github.com/defrag) 322 | - [59a604](https://github.com/coduo/php-humanizer/commit/59a6045a716ec63bfb335ea326ce4ee82cf5a4f7) - **Update README.md** - [@defrag](https://github.com/defrag) 323 | 324 | ## [1.0.0] - 2014-06-12 325 | 326 | ### Added 327 | - [#8](https://github.com/coduo/php-humanizer/pull/8) - **missing require for symfony/yaml in composer.json** - [@dedik](https://github.com/dedik) 328 | - [#4](https://github.com/coduo/php-humanizer/pull/4) - **truncate operation** - [@norberttech](https://github.com/norberttech) 329 | - [#3](https://github.com/coduo/php-humanizer/pull/3) - **roman converters** - [@defrag](https://github.com/defrag) 330 | - [#1](https://github.com/coduo/php-humanizer/pull/1) - **number and oridinalize** - [@defrag](https://github.com/defrag) 331 | - [192a29](https://github.com/coduo/php-humanizer/commit/192a29e78fb2fe8595da1a43580a0a2f7914399c) - **travis configuration** - [@norberttech](https://github.com/norberttech) 332 | 333 | ### Changed 334 | - [b5a504](https://github.com/coduo/php-humanizer/commit/b5a504fec092d6d41391a1de6db09eb756e51895) - **Merge pull request #8 from dedik/master** - [@norberttech](https://github.com/norberttech) 335 | - [673cc6](https://github.com/coduo/php-humanizer/commit/673cc617a158c83056ae7d1647467ef771a4fdbf) - **Update README.md** - [@defrag](https://github.com/defrag) 336 | - [e5906b](https://github.com/coduo/php-humanizer/commit/e5906b5ea334a52960fab67f465246079fe971e3) - **Update README.md** - [@defrag](https://github.com/defrag) 337 | - [43ba95](https://github.com/coduo/php-humanizer/commit/43ba95d307ae00d480393cce368491f62deee4f7) - **Merge pull request #7 from defrag/precise-date-fix** - [@norberttech](https://github.com/norberttech) 338 | - [#6](https://github.com/coduo/php-humanizer/pull/6) - **Precise diffs** - [@defrag](https://github.com/defrag) 339 | - [08b9d1](https://github.com/coduo/php-humanizer/commit/08b9d1b4f35d3f5846fb187248548d2148a261e5) - **Merge pull request #6 from defrag/precise-diff** - [@norberttech](https://github.com/norberttech) 340 | - [7438be](https://github.com/coduo/php-humanizer/commit/7438be84cdc9831215bf99f83601ce3c4abfeb1e) - **Merge pull request #5 from norzechowicz/time** - [@defrag](https://github.com/defrag) 341 | - [#5](https://github.com/coduo/php-humanizer/pull/5) - **[WIP] Introduce time difference humanizer** - [@norberttech](https://github.com/norberttech) 342 | - [618179](https://github.com/coduo/php-humanizer/commit/618179735f5583ca8d425a8ccf375ce0afd22e55) - **Merge pull request #4 from norzechowicz/truncate** - [@defrag](https://github.com/defrag) 343 | - [711775](https://github.com/coduo/php-humanizer/commit/71177557d8d4bc7b95e10170c34cd176a8287e38) - **Moved library to Coduo organization** - [@norberttech](https://github.com/norberttech) 344 | - [6815c6](https://github.com/coduo/php-humanizer/commit/6815c651a7570802ccc5beaf3e6408e6abab1caa) - **Merge pull request #3 from defrag/roman** - [@norberttech](https://github.com/norberttech) 345 | - [cee3c3](https://github.com/coduo/php-humanizer/commit/cee3c34860042bb93ce73d39ea32fd6b9acef3d1) - **Update readme** - [@norberttech](https://github.com/norberttech) 346 | - [fda9db](https://github.com/coduo/php-humanizer/commit/fda9db3ef94591e80d627517390c42d688021d7a) - **Merge remote-tracking branch 'origin/master'** - [@norberttech](https://github.com/norberttech) 347 | - [fd51e9](https://github.com/coduo/php-humanizer/commit/fd51e914d98d28943a34a3fea9237f4a8c6c7e90) - **Metric suffix** - [@norberttech](https://github.com/norberttech) 348 | - [7b7d4e](https://github.com/coduo/php-humanizer/commit/7b7d4e4453211e1975f3004a74670e6ebdbecb1c) - **Merge pull request #2 from pborreli/typos** - [@norberttech](https://github.com/norberttech) 349 | - [720bec](https://github.com/coduo/php-humanizer/commit/720becd16f48140d94a983e5eaa6c4e1b9879442) - **Update README.md** - [@norberttech](https://github.com/norberttech) 350 | - [e62090](https://github.com/coduo/php-humanizer/commit/e62090a6ba103a63718fd17a5d6a0001f007ecac) - **Update README.md** - [@norberttech](https://github.com/norberttech) 351 | - [d7fd45](https://github.com/coduo/php-humanizer/commit/d7fd45f39377298e35922843cfe004497898cf18) - **Binary suffix converter** - [@norberttech](https://github.com/norberttech) 352 | - [65564e](https://github.com/coduo/php-humanizer/commit/65564e1202be4e67822e40c366dd36836bdec70a) - **Refactoring** - [@norberttech](https://github.com/norberttech) 353 | - [58f3d5](https://github.com/coduo/php-humanizer/commit/58f3d560caba8ec66ca57ef66cc3e598ee5eb230) - **Merge pull request #1 from defrag/number** - [@norberttech](https://github.com/norberttech) 354 | - [35d7e6](https://github.com/coduo/php-humanizer/commit/35d7e69c62e653f2f180b96597002bf143f79ec0) - **String humanize introduction** - [@norberttech](https://github.com/norberttech) 355 | - [e2bfc6](https://github.com/coduo/php-humanizer/commit/e2bfc680b3f339f6bf2f6e39ce9a17f02eeaebbe) - **Initial commit** - [@norberttech](https://github.com/norberttech) 356 | 357 | ### Fixed 358 | - [#7](https://github.com/coduo/php-humanizer/pull/7) - **precise date calculations** - [@defrag](https://github.com/defrag) 359 | - [#2](https://github.com/coduo/php-humanizer/pull/2) - **typos** - [@pborreli](https://github.com/pborreli) 360 | 361 | ## Contributors 362 | 363 | - @4t87ux8 364 | - @a-ungurianu 365 | - @adevade 366 | - @arrowrowe 367 | - @Borales 368 | - @bpolaszek 369 | - @brianwozeniak 370 | - @cnkt 371 | - @dagaa 372 | - @ddmler 373 | - @dedik 374 | - @defrag 375 | - @dizzy7 376 | - @doenietzomoeilijk 377 | - @drgomesp 378 | - @Forst 379 | - @Gnomino 380 | - @hjason2042@gmail.com 381 | - @hyperpanic 382 | - @IgorDePaula 383 | - @isnani 384 | - @jebog 385 | - @jerony-mo 386 | - @jfcherng 387 | - @lightglitch 388 | - @lpopov 389 | - @martinbutt 390 | - @mattallty 391 | - @mostertb 392 | - @naprirfan 393 | - @norberttech 394 | - @norzechowicz 395 | - @NoUseFreak 396 | - @nwatth 397 | - @omissis 398 | - @orestes 399 | - @Ozmodiar 400 | - @pborreli 401 | - @percymamedy 402 | - @peter279k 403 | - @sam002 404 | - @sarelvdwalt 405 | - @serima 406 | - @smeeckaert 407 | - @tbreuss 408 | - @Th3Mouk 409 | - @thunderer 410 | - @vinicius73 411 | - @vinkla 412 | - @WatheqAlshowaiter 413 | 414 | Generated by [Automation](https://github.com/aeon-php/automation) --------------------------------------------------------------------------------