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

Russian language translation #36

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)
* [Русский](src/Coduo/PHPHumanizer/Resources/translations/difference.ru.yml)

# Credits

Expand Down
18 changes: 18 additions & 0 deletions spec/Coduo/PHPHumanizer/DateTimeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,22 @@ 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_ru_locale()
{
$examples = array(
array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 минута, 45 секунд назад'),
array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 час, 40 минут назад'),
array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 день, 15 минут вперед'),
array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 дней, 2 часа вперед'),
array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 год, 2 дня, 4 часа вперед'),
array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 дня, 10 часов вперед'),
array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 день, 1 час, 40 минут назад'),
array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 года, 1 день вперед'),
);

foreach ($examples as $example) {
$this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'ru')->shouldReturn($example[2]);
}
}
}
35 changes: 35 additions & 0 deletions src/Coduo/PHPHumanizer/Resources/translations/difference.ru.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
just_now:
past: "[0,Inf] прямо сейчас"
future: "[0,Inf] прямо сейчас"
second:
past: "{1} %count% секунду назад|[2,4] %count% секунды назад|[5,Inf] %count% секунд назад"
future: "{1} %count% секунду вперед|[2,4] %count% секунды вперед|[5,Inf] %count% секунд вперед"
minute:
past: "{1} %count% минуту назад|[2,4] %count% минуты назад|[5,Inf] %count% минут назад"
future: "{1} %count% минуту вперед|[2,4] %count% минуты вперед|[5,Inf] %count% минут вперед"
hour:
past: "{1} %count% час назад|[2,4] %count% часа назад|[5,Inf] %count% часов назад"
future: "{1} %count% час вперед|[2,4] %count% часа вперед|[5,Inf] %count% часов вперед"
day:
past: "{1} %count% дней назад|[2,4] %count% дня назад|[5,Inf] %count% дней назад"
future: "{1} %count% дней вперед|[2,4] %count% дня вперед|[5,Inf] %count% дней вперед"
week:
past: "{1} %count% неделю назад|[2,4] %count% недели назад|[5,Inf] %count% недель назад"
future: "{1} %count% неделю вперед|[2,4] %count% недели вперед|[5,Inf] %count% недель вперед"
month:
past: "{1} %count% месяц назад|[2,4] %count% месяца назад|[5,Inf] %count% месяцев назад"
future: "{1} %count% месяц вперед|[2,4] %count% месяца вперед|[5,Inf] %count% месяцев вперед"
year:
past: "{1} %count% год назад|[2,4] %count% года назад|[5,Inf] %count% лет назад"
future: "{1} %count% год вперед|[2,4] %count% года вперед|[5,Inf] %count% лет вперед"

compound:
second: "{1} %count% секунда|[2,4] %count% секунды|[5,Inf] %count% секунд"
minute: "{1} %count% минута|[2,4] %count% минуты|[5,Inf] %count% минут"
hour: "{1} %count% час|[2,4] %count% часа|[5,Inf] %count% часов"
day: "{1} %count% день|[2,4] %count% дня|[5,Inf] %count% дней"
week: "{1} %count% неделя|[2,4] %count% недели|[5,Inf] %count% недель"
month: "{1} %count% месяц|[2,4] %count% месяца|[5,Inf] %count% месяцев"
year: "{1} %count% год|[2,4] %count% года|[5,Inf] %count% лет"
ago: "назад"
from_now: "вперед"
3 changes: 3 additions & 0 deletions src/Coduo/PHPHumanizer/Resources/translations/oxford.ru.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
only_two: "%first% и %second%"
comma_separated: "%list%, и %last%"
comma_separated_with_limit: "{1} %list%, и еще 1|[2,Inf] %list%, и еще %count%"