diff --git a/README.md b/README.md index 2d3062e..424119b 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,7 @@ Currently we support following languages: * [Spanish] (src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml) * [Ukrainian] (src/Coduo/PHPHumanizer/Resources/translations/difference.uk.yml) * [Danish] (src/Coduo/PHPHumanizer/Resources/translations/difference.da.yml) +* [Thai] (src/Coduo/PHPHumanizer/Resources/translations/difference.th.yml) # Credits diff --git a/src/Coduo/PHPHumanizer/Resources/translations/difference.th.yml b/src/Coduo/PHPHumanizer/Resources/translations/difference.th.yml new file mode 100644 index 0000000..69f30e3 --- /dev/null +++ b/src/Coduo/PHPHumanizer/Resources/translations/difference.th.yml @@ -0,0 +1,35 @@ +just_now: + past: "[0,Inf] เมื่อสักครู่" + future: "[0,Inf] เร็วๆนี้" +second: + past: "[1,Inf] %count% วินาทีที่แล้ว" + future: "[1,Inf] อีก %count% วินาที" +minute: + past: "[1,Inf] %count% นาทีที่แล้ว" + future: "[1,Inf] อีก %count% นาที" +hour: + past: "[1,Inf] %count% ชั่วโมงที่แล้ว" + future: "[1,Inf] อีก %count% ชั่วโมง" +day: + past: "[1,Inf] %count% วันที่แล้ว" + future: "[1,Inf] อีก %count% วัน" +week: + past: "[1,Inf] %count% สัปดาห์ที่แล้ว" + future: "[1,Inf] อีก %count% สัปดาห์" +month: + past: "[1,Inf] %count% เดือนที่แล้ว" + future: "[1,Inf] อีก %count% เดือน" +year: + past: "[1,Inf] %count% ปีที่แล้ว" + future: "[1,Inf] อีก %count% ปี" + +compound: + second: "[1,Inf] %count% วินาที" + minute: "[1,Inf] %count% นาที" + hour: "[1,Inf] %count% ชั่วโมง" + day: "[1,Inf] %count% วัน" + week: "[1,Inf] %count% สัปดาห์" + month: "[1,Inf] %count% เดือน" + year: "[1,Inf] %count% ปี" + past: "%value%ที่แล้ว" + future: "อีก %value%" diff --git a/src/Coduo/PHPHumanizer/Resources/translations/oxford.th.yml b/src/Coduo/PHPHumanizer/Resources/translations/oxford.th.yml new file mode 100644 index 0000000..02dc12e --- /dev/null +++ b/src/Coduo/PHPHumanizer/Resources/translations/oxford.th.yml @@ -0,0 +1,3 @@ +only_two: "%first% และ %second%" +comma_separated: "%list% และ %last%" +comma_separated_with_limit: "{1} %list% และอีก 1|[2,Inf] %list% และอีก %count%" diff --git a/tests/Coduo/PHPHumanizer/Tests/CollectionTest.php b/tests/Coduo/PHPHumanizer/Tests/CollectionTest.php index adb5b53..4a50b6b 100644 --- a/tests/Coduo/PHPHumanizer/Tests/CollectionTest.php +++ b/tests/Coduo/PHPHumanizer/Tests/CollectionTest.php @@ -64,6 +64,13 @@ public function oxfordCollectionProvider() array(array("Michal", "Norbert", "Lukasz"), 2, 'uk', 'Michal, Norbert і ще 1'), array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'uk', 'Michal, Norbert і ще 2'), array(array("Michal", "Norbert", "Lukasz", "Pawel"), null, 'uk', 'Michal, Norbert, Lukasz та Pawel'), + + // Thai + array(array("Michal"), null, 'th', 'Michal'), + array(array("Michal", "Norbert"), null, 'th', 'Michal และ Norbert'), + array(array("Michal", "Norbert", "Lukasz"), 2, 'th', 'Michal, Norbert และอีก 1'), + array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'th', 'Michal, Norbert และอีก 2'), + array(array("Michal", "Norbert", "Lukasz", "Pawel"), null, 'th', 'Michal, Norbert, Lukasz และ Pawel'), ); } } diff --git a/tests/Coduo/PHPHumanizer/Tests/DateTimeTest.php b/tests/Coduo/PHPHumanizer/Tests/DateTimeTest.php index 8de8a95..256d8a8 100644 --- a/tests/Coduo/PHPHumanizer/Tests/DateTimeTest.php +++ b/tests/Coduo/PHPHumanizer/Tests/DateTimeTest.php @@ -212,6 +212,25 @@ public function humanizeDataProvider() array("2014-05-01", "2014-04-01", "1 måned siden", "da"), array("2015-05-01", "2014-04-01", "1 år siden", "da"), array("2014-05-01", "2016-04-01", "2 år fra nu", "da"), + + // Thai + array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'เมื่อสักครู่', 'th'), + array("2014-04-26 13:00:00", "2014-04-26 13:00:05", 'อีก 5 วินาที', 'th'), + array("2014-04-26 13:00:00", "2014-04-26 12:59:00", '1 นาทีที่แล้ว', 'th'), + array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 นาทีที่แล้ว', 'th'), + array("2014-04-26 13:00:00", "2014-04-26 13:15:00", 'อีก 15 นาที', 'th'), + array("2014-04-26 13:00:00", "2014-04-26 14:00:00", 'อีก 1 ชั่วโมง', 'th'), + array("2014-04-26 13:00:00", "2014-04-26 15:00:00", 'อีก 2 ชั่วโมง', 'th'), + array("2014-04-26 13:00:00", "2014-04-26 12:00:00", '1 ชั่วโมงที่แล้ว', 'th'), + array("2014-04-26", "2014-04-25", '1 วันที่แล้ว', 'th'), + array("2014-04-26", "2014-04-24", '2 วันที่แล้ว', 'th'), + array("2014-04-26", "2014-04-28", 'อีก 2 วัน', 'th'), + array("2014-04-01", "2014-04-15", 'อีก 2 สัปดาห์', 'th'), + array("2014-04-15", "2014-04-07", '1 สัปดาห์ที่แล้ว', 'th'), + array("2014-01-01", "2014-04-01", 'อีก 3 เดือน', 'th'), + array("2014-05-01", "2014-04-01", '1 เดือนที่แล้ว', 'th'), + array("2015-05-01", "2014-04-01", '1 ปีที่แล้ว', 'th'), + array("2014-05-01", "2016-04-01", 'อีก 2 ปี', 'th'), ); } @@ -380,6 +399,16 @@ public function preciseDifferenceDataProvider() array("2014-04-26 13:00:00", "2014-04-28 23:00:00", "2 dage, 10 timer fra nu", "da"), array("2014-04-26 13:00:00", "2014-04-25 11:20:00", "1 dag, 1 time, 40 minutter siden", "da"), array("2014-04-26 13:00:00", "2016-04-27 13:00:00", "2 år, 1 dag fra nu", "da"), + + // Thai + array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 นาที, 45 วินาทีที่แล้ว', 'th'), + array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 ชั่วโมง, 40 นาทีที่แล้ว', 'th'), + array("2014-04-26 13:00:00", "2014-04-27 13:15:00", 'อีก 1 วัน, 15 นาที', 'th'), + array("2014-04-26 13:00:00", "2014-05-03 15:00:00", 'อีก 7 วัน, 2 ชั่วโมง', 'th'), + array("2014-04-26 13:00:00", "2015-04-28 17:00:00", 'อีก 1 ปี, 2 วัน, 4 ชั่วโมง', 'th'), + array("2014-04-26 13:00:00", "2014-04-28 23:00:00", 'อีก 2 วัน, 10 ชั่วโมง', 'th'), + array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 วัน, 1 ชั่วโมง, 40 นาทีที่แล้ว', 'th'), + array("2014-04-26 13:00:00", "2016-04-27 13:00:00", 'อีก 2 ปี, 1 วัน', 'th'), ); } }