From f90bc6796f4b7a638bd8d06c517a3e77da0ae8e0 Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Thu, 29 Oct 2015 00:28:24 +0100 Subject: [PATCH 1/6] Add Spanish translation. --- .../Resources/translations/difference.es.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml diff --git a/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml b/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml new file mode 100644 index 0000000..efc88d6 --- /dev/null +++ b/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml @@ -0,0 +1,35 @@ +just_now: + past: "[0,Inf] ahora mismo" + future: "[0,Inf] ahora mismo" +second: + past: "{1} Hace %count% segundo |[2,Inf] Hace %count% segundos" + future: "{1} Dentro de %count% segundo|[2,Inf] Dentro de %count% segundos" +minute: + past: "{1} Hace %count% minuto|[2,Inf] Hace %count% minutos" + future: "{1} Dentro de %count% minuto|[2,Inf] Dentro de %count% minutos" +hour: + past: "{1} Hace %count% hora|[2,Inf] Hace %count% horas" + future: "{1} Dentro de %count% hora|[2,Inf] Dentro de %count% horas" +day: + past: "{1} Hace %count% día|[2,Inf] Hace %count% días" + future: "{1} Dentro de %count% día|[2,Inf] Dentro de %count% días" +week: + past: "{1} Hace %count% semana|[2,Inf] Hace %count% semanas" + future: "{1} Dentro de %count% semana|[2,Inf] Dentro de %count% semanas" +month: + past: "{1} Hace %count% mes|[2,Inf] Hace %count% meses" + future: "{1} Dentro de %count% mes|[2,Inf] Dentro de %count% meses" +year: + past: "{1} Hace %count% año|[2,Inf] Hace %count% años" + future: "{1} Dentro de %count% año|[2,Inf] Dentro de %count% años" + +compound: + second: "{1} %count% segundo|[2,Inf] %count% segundos" + minute: "{1} %count% minuto|[2,Inf] %count% minutos" + hour: "{1} %count% hora|[2,Inf] %count% horas" + day: "{1} %count% día|[2,Inf] %count% días" + week: "{1} %count% semana|[2,Inf] %count% semanas" + month: "{1} %count% mes|[2,Inf] %count% meses" + year: "{1} %count% año|[2,Inf] %count% años" + ago: "atrás" + from_now: "a partir de ahora" \ No newline at end of file From 95f8ae643c7c4236ee88d4a625fa079c115ef576 Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Tue, 3 Nov 2015 23:51:36 +0100 Subject: [PATCH 2/6] Update difference compound translation for past/future --- .../PHPHumanizer/Resources/translations/difference.es.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml b/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml index efc88d6..28582c1 100644 --- a/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml +++ b/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml @@ -31,5 +31,5 @@ compound: week: "{1} %count% semana|[2,Inf] %count% semanas" month: "{1} %count% mes|[2,Inf] %count% meses" year: "{1} %count% año|[2,Inf] %count% años" - ago: "atrás" - from_now: "a partir de ahora" \ No newline at end of file + past: "hace %value%" + future: "dentro de %value%" From 2b3bb8f60a40369a408e06d7c509d1afddc6f9db Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Tue, 3 Nov 2015 23:51:56 +0100 Subject: [PATCH 3/6] Add translation for Oxford collection --- src/Coduo/PHPHumanizer/Resources/translations/oxford.es.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/Coduo/PHPHumanizer/Resources/translations/oxford.es.yml diff --git a/src/Coduo/PHPHumanizer/Resources/translations/oxford.es.yml b/src/Coduo/PHPHumanizer/Resources/translations/oxford.es.yml new file mode 100644 index 0000000..1335e9f --- /dev/null +++ b/src/Coduo/PHPHumanizer/Resources/translations/oxford.es.yml @@ -0,0 +1,3 @@ +only_two: "%first% y %second%" +comma_separated: "%list%, y %last%" +comma_separated_with_limit: "{1} %list%, y 1 más|[2,Inf] %list%, y %count% más" From dc259146e4df0cee58367cd96f9fff4a02262d90 Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Tue, 3 Nov 2015 23:52:43 +0100 Subject: [PATCH 4/6] Update translations list on README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 26859fe..209fe80 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ Currently we support following languages: * [Bulgarian] (src/Coduo/PHPHumanizer/Resources/translations/difference.bg.yml) * [Indonesian] (src/Coduo/PHPHumanizer/Resources/translations/difference.id.yml) * [Chinese Simplified] (src/Coduo/PHPHumanizer/Resources/translations/difference.zh_CN.yml) +* [Spanish] (src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml) # Credits From 3f27953f463f7c3878a89054d7af5e080ecfe3b5 Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Thu, 5 Nov 2015 18:07:18 +0100 Subject: [PATCH 5/6] All transation strings transformed to lowerspace. --- .../Resources/translations/difference.es.yml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml b/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml index 28582c1..0cc130c 100644 --- a/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml +++ b/src/Coduo/PHPHumanizer/Resources/translations/difference.es.yml @@ -2,26 +2,26 @@ just_now: past: "[0,Inf] ahora mismo" future: "[0,Inf] ahora mismo" second: - past: "{1} Hace %count% segundo |[2,Inf] Hace %count% segundos" - future: "{1} Dentro de %count% segundo|[2,Inf] Dentro de %count% segundos" + past: "{1} hace %count% segundo |[2,Inf] hace %count% segundos" + future: "{1} dentro de %count% segundo|[2,Inf] dentro de %count% segundos" minute: - past: "{1} Hace %count% minuto|[2,Inf] Hace %count% minutos" - future: "{1} Dentro de %count% minuto|[2,Inf] Dentro de %count% minutos" + past: "{1} hace %count% minuto|[2,Inf] hace %count% minutos" + future: "{1} dentro de %count% minuto|[2,Inf] dentro de %count% minutos" hour: - past: "{1} Hace %count% hora|[2,Inf] Hace %count% horas" - future: "{1} Dentro de %count% hora|[2,Inf] Dentro de %count% horas" + past: "{1} hace %count% hora|[2,Inf] hace %count% horas" + future: "{1} dentro de %count% hora|[2,Inf] dentro de %count% horas" day: - past: "{1} Hace %count% día|[2,Inf] Hace %count% días" - future: "{1} Dentro de %count% día|[2,Inf] Dentro de %count% días" + past: "{1} hace %count% día|[2,Inf] hace %count% días" + future: "{1} dentro de %count% día|[2,Inf] dentro de %count% días" week: - past: "{1} Hace %count% semana|[2,Inf] Hace %count% semanas" - future: "{1} Dentro de %count% semana|[2,Inf] Dentro de %count% semanas" + past: "{1} hace %count% semana|[2,Inf] hace %count% semanas" + future: "{1} dentro de %count% semana|[2,Inf] dentro de %count% semanas" month: - past: "{1} Hace %count% mes|[2,Inf] Hace %count% meses" - future: "{1} Dentro de %count% mes|[2,Inf] Dentro de %count% meses" + past: "{1} hace %count% mes|[2,Inf] hace %count% meses" + future: "{1} dentro de %count% mes|[2,Inf] dentro de %count% meses" year: - past: "{1} Hace %count% año|[2,Inf] Hace %count% años" - future: "{1} Dentro de %count% año|[2,Inf] Dentro de %count% años" + past: "{1} hace %count% año|[2,Inf] hace %count% años" + future: "{1} dentro de %count% año|[2,Inf] dentro de %count% años" compound: second: "{1} %count% segundo|[2,Inf] %count% segundos" From 5260e9131a30e42c2cbe9685ed67ffb1676b3433 Mon Sep 17 00:00:00 2001 From: Orestes Carracedo Date: Thu, 5 Nov 2015 18:07:53 +0100 Subject: [PATCH 6/6] Add tests. --- .../Coduo/PHPHumanizer/Tests/DateTimeTest.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/Coduo/PHPHumanizer/Tests/DateTimeTest.php b/tests/Coduo/PHPHumanizer/Tests/DateTimeTest.php index 3d6669f..2835a80 100644 --- a/tests/Coduo/PHPHumanizer/Tests/DateTimeTest.php +++ b/tests/Coduo/PHPHumanizer/Tests/DateTimeTest.php @@ -155,6 +155,25 @@ public function humanizeDataProvider() array("2014-05-01", "2014-04-01", '1 bulan yang lalu', 'id'), array("2015-05-01", "2014-04-01", '1 tahun yang lalu', 'id'), array("2014-05-01", "2016-04-01", '2 tahun dari sekarang', 'id'), + + // Spanish + array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'ahora mismo', 'es'), + array("2014-04-26 13:00:00", "2014-04-26 13:00:05", 'dentro de 5 segundos', 'es'), + array("2014-04-26 13:00:00", "2014-04-26 12:59:00", 'hace 1 minuto', 'es'), + array("2014-04-26 13:00:00", "2014-04-26 12:45:00", 'hace 15 minutos', 'es'), + array("2014-04-26 13:00:00", "2014-04-26 13:15:00", 'dentro de 15 minutos', 'es'), + array("2014-04-26 13:00:00", "2014-04-26 14:00:00", 'dentro de 1 hora', 'es'), + array("2014-04-26 13:00:00", "2014-04-26 15:00:00", 'dentro de 2 horas', 'es'), + array("2014-04-26 13:00:00", "2014-04-26 12:00:00", 'hace 1 hora', 'es'), + array("2014-04-26", "2014-04-25", 'hace 1 día', 'es'), + array("2014-04-26", "2014-04-24", 'hace 2 días', 'es'), + array("2014-04-26", "2014-04-28", 'dentro de 2 días', 'es'), + array("2014-04-01", "2014-04-15", 'dentro de 2 semanas', 'es'), + array("2014-04-15", "2014-04-07", 'hace 1 semana', 'es'), + array("2014-01-01", "2014-04-01", 'dentro de 3 meses', 'es'), + array("2014-05-01", "2014-04-01", 'hace 1 mes', 'es'), + array("2015-05-01", "2014-04-01", 'hace 1 año', 'es'), + array("2014-05-01", "2016-04-01", 'dentro de 2 años', 'es'), ); } @@ -293,6 +312,16 @@ public function preciseDifferenceDataProvider() array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 hari, 10 jam dari sekarang', 'id'), array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 hari, 1 jam, 40 menit yang lalu', 'id'), array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 tahun, 1 hari dari sekarang', 'id'), + + // Spanish + array("2014-04-26 13:00:00", "2014-04-26 12:58:15", 'hace 1 minuto, 45 segundos', 'es'), + array("2014-04-26 13:00:00", "2014-04-26 11:20:00", 'hace 1 hora, 40 minutos', 'es'), + array("2014-04-26 13:00:00", "2014-04-27 13:15:00", 'dentro de 1 día, 15 minutos', 'es'), + array("2014-04-26 13:00:00", "2014-05-03 15:00:00", 'dentro de 7 días, 2 horas', 'es'), + array("2014-04-26 13:00:00", "2015-04-28 17:00:00", 'dentro de 1 año, 2 días, 4 horas', 'es'), + array("2014-04-26 13:00:00", "2014-04-28 23:00:00", 'dentro de 2 días, 10 horas', 'es'), + array("2014-04-26 13:00:00", "2014-04-25 11:20:00", 'hace 1 día, 1 hora, 40 minutos', 'es'), + array("2014-04-26 13:00:00", "2016-04-27 13:00:00", 'dentro de 2 años, 1 día', 'es'), ); } }