Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions spec/Coduo/PHPHumanizer/DateTimeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,21 @@ function it_humanizes_precise_difference_between_dates_for_it_locale()
$this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'it')->shouldReturn($example[2]);
}
}

function it_humanizes_precise_difference_between_dates_for_no_locale()
{
$examples = array(
array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minutt, 45 sekunder siden'),
array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 time, 40 minutter siden'),
array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 dag, 15 minutter fra nå'),
array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 dager, 2 timer fra nå'),
array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 år, 2 dager, 4 timer fra nå'),
array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 dager, 10 timer fra nå'),
array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 dag, 1 time, 40 minutter siden'),
array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 år, 1 dag fra nå'),
);
foreach ($examples as $example) {
$this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'no')->shouldReturn($example[2]);
}
}
}
35 changes: 35 additions & 0 deletions src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
just_now:
past: "[0,Inf] akkurat nå"
future: "[0,Inf] akkurat nå"
second:
past: "{1} %count% sekund siden|[2,Inf] %count% sekunder siden"
future: "{1} %count% sekund fra nå|[2,Inf] %count% sekunder fra nå"
minute:
past: "{1} %count% minutt siden|[2,Inf] %count% minutter siden"
future: "{1} %count% minutt fra nå|[2,Inf] %count% minutter fra nå"
hour:
past: "{1} %count% time siden|[2,Inf] %count% timer siden"
future: "{1} %count% time fra nå|[2,Inf] %count% timer fra nå"
day:
past: "{1} %count% dag siden|[2,Inf] %count% dager siden"
future: "{1} %count% dag fra nå|[2,Inf] %count% dager fra nå"
week:
past: "{1} %count% uke siden|[2,Inf] %count% uker siden"
future: "{1} %count% uke fra nå|[2,Inf] %count% uker fra nå"
month:
past: "{1} %count% måned siden|[2,Inf] %count% måneder siden"
future: "{1} %count% måned fra nå|[2,Inf] %count% måneder fra nå"
year:
past: "{1} %count% år siden|[2,Inf] %count% år siden"
future: "{1} %count% år fra nå|[2,Inf] %count% år fra nå"

compound:
second: "{1} %count% sekund|[2,Inf] %count% sekunder"
minute: "{1} %count% minutt|[2,Inf] %count% minutter"
hour: "{1} %count% time|[2,Inf] %count% timer"
day: "{1} %count% dag|[2,Inf] %count% dager"
week: "{1} %count% uke|[2,Inf] %count% uker"
month: "{1} %count% måned|[2,Inf] %count% måneder"
year: "{1} %count% år|[2,Inf] %count% år"
ago: "siden"
from_now: "fra nå"