Skip to content

Commit 5ddd97f

Browse files
author
Norbert Orzechowicz
committed
Merge pull request #28 from sarelvdwalt/master
Addition of Afrikaans (af) language translation (with spec tests)
2 parents 1f92438 + b0759cb commit 5ddd97f

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#A quick guide to contribute to the project:
2+
3+
##Installing the dev environment
4+
5+
1. Fork the repo
6+
2. Clone the repo to local
7+
3. Install dependencies: `composer install` (this assumes you have 'composer' aliased to whereever your composer.phar lives)
8+
4. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate:
9+
`./bin/phpspec run --format=pretty`
10+
11+
##The actual contribution
12+
13+
1. Make the changes/additions to the code, committing often and making clear what you've done
14+
2. Make sure you write tests for your code, located in the folder structure `spec/Coduo/PHPHumanizer/...`
15+
3. Run your tests (often and while coding): `./bin/phpspec run --format=pretty`
16+
17+
##Coding Standards
18+
19+
Try use similar coding standards to what you see in the project to keep things clear to the contributors. If you're unsure, it's always a safe bet to fall-back to the PSR standards.
20+
21+
[PSR-1: Basic Coding Standard](http://www.php-fig.org/psr/psr-1/)
22+
23+
[PSR-2: Coding Style Guide](http://www.php-fig.org/psr/psr-2/)

spec/Coduo/PHPHumanizer/DateTimeSpec.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,36 @@ function it_humanize_difference_between_dates_for_pl_locale()
6464
}
6565
}
6666

67+
function it_humanize_difference_between_dates_for_af_locale()
68+
{
69+
$examples = array(
70+
array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'nou nou'),
71+
array("2014-04-26 13:00:00", "2014-04-26 13:00:05", '5 sekondes van nou af'),
72+
array("2014-04-26 13:00:00", "2014-04-26 12:59:00", '1 minuut gelede'),
73+
array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 minute gelede'),
74+
array("2014-04-26 13:00:00", "2014-04-26 13:15:00", '15 minute van nou af'),
75+
array("2014-04-26 13:00:00", "2014-04-26 14:00:00", '1 uur van nou af'),
76+
array("2014-04-26 13:00:00", "2014-04-26 15:00:00", '2 ure van nou af'),
77+
array("2014-04-26 13:00:00", "2014-04-26 12:00:00", '1 uur gelede'),
78+
array("2014-04-26 13:00:00", "2014-04-26 11:00:00", '2 ure gelede'),
79+
array("2014-04-26 13:00:00", "2014-04-26 12:00:00", '1 uur gelede'),
80+
array("2014-04-26", "2014-04-25", '1 dag gelede'),
81+
array("2014-04-26", "2014-04-24", '2 dae gelede'),
82+
array("2014-04-26", "2014-04-28", '2 dae van nou af'),
83+
array("2014-04-01", "2014-04-15", '2 weke van nou af'),
84+
array("2014-04-15", "2014-04-07", '1 week gelede'),
85+
array("2014-01-01", "2014-04-01", '3 maande van nou af'),
86+
array("2014-05-01", "2014-04-01", '1 maand gelede'),
87+
array("2015-05-01", "2014-04-01", '1 jaar gelede'),
88+
array("2014-05-01", "2016-04-01", '2 jaar van nou af'),
89+
array("2014-05-01", "2009-04-01", '5 jaar gelede'),
90+
);
91+
92+
foreach ($examples as $example) {
93+
$this->difference(new \DateTime($example[0]), new \DateTime($example[1]), 'af')->shouldReturn($example[2]);
94+
}
95+
}
96+
6797
function it_humanizes_precise_difference_between_dates()
6898
{
6999
$examples = array(
@@ -100,6 +130,24 @@ function it_humanizes_precise_difference_between_dates_for_pl_locale()
100130
}
101131
}
102132

133+
function it_humanizes_precise_difference_between_dates_for_af_locale()
134+
{
135+
$examples = array(
136+
array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minuut, 45 sekondes gelede'),
137+
array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 uur, 40 minute gelede'),
138+
array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 dag, 15 minute van nou af'),
139+
array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 dae, 2 ure van nou af'),
140+
array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 jaar, 2 dae, 4 ure van nou af'),
141+
array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 dae, 10 ure van nou af'),
142+
array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 dag, 1 uur, 40 minute gelede'),
143+
array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 jaar, 1 dag van nou af'),
144+
);
145+
146+
foreach ($examples as $example) {
147+
$this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'af')->shouldReturn($example[2]);
148+
}
149+
}
150+
103151
function it_humanizes_precise_difference_between_dates_for_de_locale()
104152
{
105153
$examples = array(
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
just_now:
2+
past: "[0,Inf] nou nou"
3+
future: "[0,Inf] netnou"
4+
second:
5+
past: "{1} %count% sekonde gelede|[2,Inf] %count% sekondes gelede"
6+
future: "{1} %count% sekonde van nou af|[2,Inf] %count% sekondes van nou af"
7+
minute:
8+
past: "{1} %count% minuut gelede|[2,Inf] %count% minute gelede"
9+
future: "{1} %count% minuut van nou af|[2,Inf] %count% minute van nou af"
10+
hour:
11+
past: "{1} %count% uur gelede|[2,Inf] %count% ure gelede"
12+
future: "{1} %count% uur van nou af|[2,Inf] %count% ure van nou af"
13+
day:
14+
past: "{1} %count% dag gelede|[2,Inf] %count% dae gelede"
15+
future: "{1} %count% dag van nou af|[2,Inf] %count% dae van nou af"
16+
week:
17+
past: "{1} %count% week gelede|[2,Inf] %count% weke gelede"
18+
future: "{1} %count% week van nou af|[2,Inf] %count% weke van nou af"
19+
month:
20+
past: "{1} %count% maand gelede|[2,Inf] %count% maande gelede"
21+
future: "{1} %count% maand van nou af|[2,Inf] %count% maande van nou af"
22+
year:
23+
past: "{1} %count% jaar gelede|[2,Inf] %count% jaar gelede"
24+
future: "{1} %count% jaar van nou af|[2,Inf] %count% jaar van nou af"
25+
26+
compound:
27+
second: "{1} %count% sekonde|[2,Inf] %count% sekondes"
28+
minute: "{1} %count% minuut|[2,Inf] %count% minute"
29+
hour: "{1} %count% uur|[2,Inf] %count% ure"
30+
day: "{1} %count% dag|[2,Inf] %count% dae"
31+
week: "{1} %count% week|[2,Inf] %count% weke"
32+
month: "{1} %count% maand|[2,Inf] %count% maande"
33+
year: "{1} %count% jaar|[2,Inf] %count% jaar"
34+
ago: "gelede"
35+
from_now: "van nou af"

0 commit comments

Comments
 (0)