Permalink
Browse files

Merge remote-tracking branch 'origin/master'

  • Loading branch information...
2 parents a036f39 + 18a94f0 commit 2c62d9b99ec97f00dcccfd0837e27a6902cbedca @cweiske cweiske committed Jun 4, 2012
Showing with 37 additions and 3 deletions.
  1. +2 −2 src/Date/HumanDiff.php
  2. +28 −0 src/Date/HumanDiff/Lang/el.php
  3. +7 −1 tests/Date/HumanDiffTest.php
@@ -84,8 +84,8 @@ public function __construct()
/**
* Generate a human readable time difference.
*
- * @param int $timestamp Timestamp to get difference to
- * @param int $reference Reference timestamp to get difference from.
+ * @param int|DateTime $timestamp Timestamp to get difference to
+ * @param int|DateTime $reference Reference timestamp to get difference from.
* If omitted, it's set to the current time.
*
* @return string Human readable time difference ("a week ago")
@@ -0,0 +1,28 @@
+<?php
+require_once 'Date/HumanDiff/LangArray.php';
+
+class Date_HumanDiff_Lang_el extends Date_HumanDiff_LangArray
+{
+ /**
+ * Translation array.
+ * Key is the english variant, value the greek translation.
+ *
+ * @var array
+ */
+ public $trans = array(
+ 'just now' => 'μόλις τώρα',
+ 'a minute ago' => 'πριν ένα λεπτό',
+ '%d minutes ago' => 'πριν %d λεπτά',
+ 'an hour ago' => 'πριν μία ώρα',
+ '%d hours ago' => 'πριν %d ώρες',
+ 'yesterday' => 'εχθές',
+ '%d days ago' => 'πριν %d ημέρες',
+ 'a week ago' => 'πριν μια εβδομάδα',
+ '%d weeks ago' => 'πρίν %d εβδομάδες',
+ 'a month ago' => 'πριν ένα μήνα',
+ '%d months ago' => 'πριν %d μήνες',
+ 'a year ago' => 'πριν ένα χρόνο',
+ '%d years ago' => 'πριν %d χρόνια',
+ );
+}
+?>
@@ -101,12 +101,18 @@ public function testSetLocaleExisting()
{
$this->assertTrue($this->dh->setLocale('de'));
$this->assertEquals('gerade eben', $this->dh->get(time()));
+
+ $this->assertTrue($this->dh->setLanguage('el'));
+ $this->assertEquals('μόλις τώρα', $this->dh->get(time()));
}
public function testSetLocaleParentExisting()
{
$this->assertTrue($this->dh->setLocale('de_AT'));
$this->assertEquals('gerade eben', $this->dh->get(time()));
+
+ $this->assertTrue($this->dh->setLanguage('el_GR'));
+ $this->assertEquals('μόλις τώρα', $this->dh->get(time()));
}
public function testSetLocaleNotExisting()
@@ -140,4 +146,4 @@ public function testAddFormatSorted()
}
}
-?>
+?>

0 comments on commit 2c62d9b

Please sign in to comment.