diff --git a/src/Humanizer.Tests.Shared/Localisation/ru-RU/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/ru-RU/TimeSpanHumanizeTests.cs index 4e68e07de..2106e7efe 100644 --- a/src/Humanizer.Tests.Shared/Localisation/ru-RU/TimeSpanHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/ru-RU/TimeSpanHumanizeTests.cs @@ -5,44 +5,49 @@ public class TimeSpanHumanizeTests { [Theory] [Trait("Translation", "Native speaker")] - [InlineData(366, "один год")] + [InlineData(366, "один год", true)] + [InlineData(366, "1 год")] [InlineData(731, "2 года")] [InlineData(1096, "3 года")] [InlineData(4018, "11 лет")] - public void Years(int days, string expected) => - Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: TimeUnit.Year)); + public void Years(int days, string expected, bool toWords = false) => + Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: TimeUnit.Year, toWords: toWords)); [Theory] [Trait("Translation", "Native speaker")] - [InlineData(31, "один месяц")] + [InlineData(31, "один месяц", true)] + [InlineData(31, "1 месяц")] [InlineData(61, "2 месяца")] [InlineData(92, "3 месяца")] [InlineData(335, "11 месяцев")] - public void Months(int days, string expected) => - Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: TimeUnit.Year)); + public void Months(int days, string expected, bool toWords = false) => + Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: TimeUnit.Year, toWords: toWords)); [Theory] - [InlineData(7, "одна неделя")] + [InlineData(7, "одна неделя", true)] + [InlineData(7, "1 неделя")] [InlineData(14, "2 недели")] [InlineData(21, "3 недели")] [InlineData(28, "4 недели")] [InlineData(35, "5 недель")] [InlineData(77, "11 недель")] - public void Weeks(int days, string expected) => - Assert.Equal(expected, TimeSpan.FromDays(days).Humanize()); + public void Weeks(int days, string expected, bool toWords = false) => + Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(toWords: toWords)); [Theory] - [InlineData(1, "один день")] + [InlineData(1, "один день", true)] + [InlineData(1, "1 день")] [InlineData(2, "2 дня")] [InlineData(3, "3 дня")] [InlineData(4, "4 дня")] [InlineData(5, "5 дней")] [InlineData(6, "6 дней")] - public void Days(int days, string expected) => - Assert.Equal(expected, TimeSpan.FromDays(days).Humanize()); + public void Days(int days, string expected, bool toWords = false) => + Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(toWords: toWords)); [Theory] - [InlineData(1, "один час")] + [InlineData(1, "один час", true)] + [InlineData(1, "1 час")] [InlineData(2, "2 часа")] [InlineData(3, "3 часа")] [InlineData(4, "4 часа")] @@ -55,11 +60,12 @@ public void Days(int days, string expected) => [InlineData(21, "21 час")] [InlineData(22, "22 часа")] [InlineData(23, "23 часа")] - public void Hours(int hours, string expected) => - Assert.Equal(expected, TimeSpan.FromHours(hours).Humanize()); + public void Hours(int hours, string expected, bool toWords = false) => + Assert.Equal(expected, TimeSpan.FromHours(hours).Humanize(toWords: toWords)); [Theory] - [InlineData(1, "одна минута")] + [InlineData(1, "одна минута", true)] + [InlineData(1, "1 минута")] [InlineData(2, "2 минуты")] [InlineData(3, "3 минуты")] [InlineData(4, "4 минуты")] @@ -75,11 +81,12 @@ public void Hours(int hours, string expected) => [InlineData(24, "24 минуты")] [InlineData(25, "25 минут")] [InlineData(40, "40 минут")] - public void Minutes(int minutes, string expected) => - Assert.Equal(expected, TimeSpan.FromMinutes(minutes).Humanize()); + public void Minutes(int minutes, string expected, bool toWords = false) => + Assert.Equal(expected, TimeSpan.FromMinutes(minutes).Humanize(toWords: toWords)); [Theory] - [InlineData(1, "одна секунда")] + [InlineData(1, "одна секунда", true)] + [InlineData(1, "1 секунда")] [InlineData(2, "2 секунды")] [InlineData(3, "3 секунды")] [InlineData(4, "4 секунды")] @@ -95,11 +102,12 @@ public void Minutes(int minutes, string expected) => [InlineData(24, "24 секунды")] [InlineData(25, "25 секунд")] [InlineData(40, "40 секунд")] - public void Seconds(int seconds, string expected) => - Assert.Equal(expected, TimeSpan.FromSeconds(seconds).Humanize()); + public void Seconds(int seconds, string expected, bool toWords = false) => + Assert.Equal(expected, TimeSpan.FromSeconds(seconds).Humanize(toWords: toWords)); [Theory] - [InlineData(1, "одна миллисекунда")] + [InlineData(1, "одна миллисекунда", true)] + [InlineData(1, "1 миллисекунда")] [InlineData(2, "2 миллисекунды")] [InlineData(3, "3 миллисекунды")] [InlineData(4, "4 миллисекунды")] @@ -115,8 +123,8 @@ public void Seconds(int seconds, string expected) => [InlineData(24, "24 миллисекунды")] [InlineData(25, "25 миллисекунд")] [InlineData(40, "40 миллисекунд")] - public void Milliseconds(int milliseconds, string expected) => - Assert.Equal(expected, TimeSpan.FromMilliseconds(milliseconds).Humanize()); + public void Milliseconds(int milliseconds, string expected, bool toWords = false) => + Assert.Equal(expected, TimeSpan.FromMilliseconds(milliseconds).Humanize(toWords: toWords)); [Fact] public void NoTime() => diff --git a/src/Humanizer/Properties/Resources.ru.resx b/src/Humanizer/Properties/Resources.ru.resx index c10b26311..1fc1bdc5c 100644 --- a/src/Humanizer/Properties/Resources.ru.resx +++ b/src/Humanizer/Properties/Resources.ru.resx @@ -246,22 +246,22 @@ {0} неделя - + один день - + один час - + одна миллисекунда - + одна минута - + одна секунда - + одна неделя @@ -357,10 +357,34 @@ {0} год - + один месяц - + один год + + 1 день + + + 1 час + + + 1 миллисекунда + + + 1 минута + + + 1 месяц + + + 1 секунда + + + 1 неделя + + + 1 год + \ No newline at end of file