Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translations for es_ES #48

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Currently we support following languages:
* [Português - Brasil](src/Coduo/PHPHumanizer/Resources/translations/difference.pt_BR.yml)
* [Italian](src/Coduo/PHPHumanizer/Resources/translations/difference.it.yml)
* [Dutch](src/Coduo/PHPHumanizer/Resources/translations/difference.nl.yml)
* [Spanish(Castilian) - Spain](src/Coduo/PHPHumanizer/Resources/translations/difference.es_ES.yml)

# Credits

Expand Down
15 changes: 15 additions & 0 deletions spec/Coduo/PHPHumanizer/CollectionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,19 @@ function it_humanizes_collections_for_dutch_locale()
$this->oxford($example[0], $example[1], 'nl')->shouldReturn($example[2]);
}
}

function it_humanizes_collections_for_spanish_locale()
{
$examples = array(
array(array("Michal"), null, 'Michal'),
array(array("Michal", "Norbert"), null, 'Michal y Norbert'),
array(array("Michal", "Norbert", "Lukasz"), 2, 'Michal, Norbert, y 1 más'),
array(array("Michal", "Norbert", "Lukasz", "Pawel"), 2, 'Michal, Norbert, y 2 más'),
array(array("Michal", "Norbert", "Lukasz", "Pawel"), null, 'Michal, Norbert, Lukasz, y Pawel'),
);

foreach ($examples as $example) {
$this->oxford($example[0], $example[1], 'es_ES')->shouldReturn($example[2]);
}
}
}
21 changes: 19 additions & 2 deletions spec/Coduo/PHPHumanizer/DateTimeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ 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_humanize_difference_between_dates_for_bg_locale()
{
$examples = array(
Expand All @@ -309,7 +309,7 @@ function it_humanize_difference_between_dates_for_bg_locale()
$this->difference(new \DateTime($example[0]), new \DateTime($example[1]), 'bg')->shouldReturn($example[2]);
}
}

function it_humanizes_precise_difference_between_dates_for_bg_locale()
{
$examples = array(
Expand Down Expand Up @@ -344,4 +344,21 @@ function it_humanizes_precise_difference_between_dates_for_no_locale()
$this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'no')->shouldReturn($example[2]);
}
}

function it_humanizes_precise_difference_between_dates_for_es_ES_locale()
{
$examples = array(
array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minuto, 45 segundos atrás'),
array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 hora, 40 minutos atrás'),
array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 día, 15 minutos desde ahora'),
array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 días, 2 horas desde ahora'),
array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 año, 2 días, 4 horas desde ahora'),
array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 días, 10 horas desde ahora'),
array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 día, 1 hora, 40 minutos atrás'),
array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 años, 1 día desde ahora'),
);
foreach ($examples as $example) {
$this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'es_ES')->shouldReturn($example[2]);
}
}
}
35 changes: 35 additions & 0 deletions src/Coduo/PHPHumanizer/Resources/translations/difference.es_ES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
just_now:
past: "[0,Inf] en este momento"
future: "[0,Inf] en este momento"
second:
past: "{1} %count% segundo atrás|[2,Inf] %count% atrás"
future: "{1} %count% segundo desde ahora|[2,Inf] %count% segundos desde ahora"
minute:
past: "{1} %count% minuto|[2,Inf] hace %count% minutos atrás"
future: "{1} %count% minuto|[2,Inf] en %count% minutos desde ahora"
hour:
past: "{1} %count% hora|[2,Inf] hace %count% horas atrás"
future: "{1} %count% horas|[2,Inf] en %count% horas desde ahora"
day:
past: "{1} %count% día|[2,Inf] hace %count% días atrás"
future: "{1} %count% día|[2,Inf] en %count% días desde ahora"
week:
past: "{1} %count% semana|[2,Inf] hace %count% semanas atrás"
future: "{1} %count% semana|[2,Inf] en %count% semanas desde ahora"
month:
past: "{1} %count% mes|[2,Inf] hace %count% meses atrás"
future: "{1} %count% mes|[2,Inf] en %count% meses desde ahora"
year:
past: "{1} %count% año|[2,Inf] hace %count% años atrás"
future: "{1} %count% año|[2,Inf] en %count% años desde ahora"

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: "desde ahora"
Original file line number Diff line number Diff line change
@@ -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"