From 7e9ee2e430fd64a13f0b3895dead2b9d98eb2751 Mon Sep 17 00:00:00 2001 From: Dag-Arne Alnes Date: Thu, 29 Oct 2015 09:04:54 +0100 Subject: [PATCH 1/2] Add Norwegian translation --- .../Resources/translations/difference.no.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml diff --git a/src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml b/src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml new file mode 100644 index 0000000..183dfe4 --- /dev/null +++ b/src/Coduo/PHPHumanizer/Resources/translations/difference.no.yml @@ -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å" \ No newline at end of file From c697c4c21b3538dbab363326497f19790f74f025 Mon Sep 17 00:00:00 2001 From: Dag-Arne Alnes Date: Thu, 29 Oct 2015 14:12:24 +0100 Subject: [PATCH 2/2] Added Norwegian locale specs --- spec/Coduo/PHPHumanizer/DateTimeSpec.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/Coduo/PHPHumanizer/DateTimeSpec.php b/spec/Coduo/PHPHumanizer/DateTimeSpec.php index ead80e9..6d25ea7 100644 --- a/spec/Coduo/PHPHumanizer/DateTimeSpec.php +++ b/spec/Coduo/PHPHumanizer/DateTimeSpec.php @@ -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]); + } + } }