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

Updated Russian localization resources. fixes #1444 #1445

Merged
merged 1 commit into from
Feb 24, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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 часа")]
Expand All @@ -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 минуты")]
Expand All @@ -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 секунды")]
Expand All @@ -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 миллисекунды")]
Expand All @@ -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() =>
Expand Down
40 changes: 32 additions & 8 deletions src/Humanizer/Properties/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -246,22 +246,22 @@
<data name="TimeSpanHumanize_MultipleWeeks_Singular" xml:space="preserve">
<value>{0} неделя</value>
</data>
<data name="TimeSpanHumanize_SingleDay" xml:space="preserve">
<data name="TimeSpanHumanize_SingleDay_Words" xml:space="preserve">
<value>один день</value>
</data>
<data name="TimeSpanHumanize_SingleHour" xml:space="preserve">
<data name="TimeSpanHumanize_SingleHour_Words" xml:space="preserve">
<value>один час</value>
</data>
<data name="TimeSpanHumanize_SingleMillisecond" xml:space="preserve">
<data name="TimeSpanHumanize_SingleMillisecond_Words" xml:space="preserve">
<value>одна миллисекунда</value>
</data>
<data name="TimeSpanHumanize_SingleMinute" xml:space="preserve">
<data name="TimeSpanHumanize_SingleMinute_Words" xml:space="preserve">
<value>одна минута</value>
</data>
<data name="TimeSpanHumanize_SingleSecond" xml:space="preserve">
<data name="TimeSpanHumanize_SingleSecond_Words" xml:space="preserve">
<value>одна секунда</value>
</data>
<data name="TimeSpanHumanize_SingleWeek" xml:space="preserve">
<data name="TimeSpanHumanize_SingleWeek_Words" xml:space="preserve">
<value>одна неделя</value>
</data>
<data name="TimeSpanHumanize_Zero" xml:space="preserve">
Expand Down Expand Up @@ -357,10 +357,34 @@
<data name="TimeSpanHumanize_MultipleYears_Singular" xml:space="preserve">
<value>{0} год</value>
</data>
<data name="TimeSpanHumanize_SingleMonth" xml:space="preserve">
<data name="TimeSpanHumanize_SingleMonth_Words" xml:space="preserve">
<value>один месяц</value>
</data>
<data name="TimeSpanHumanize_SingleYear" xml:space="preserve">
<data name="TimeSpanHumanize_SingleYear_Words" xml:space="preserve">
<value>один год</value>
</data>
<data name="TimeSpanHumanize_SingleDay" xml:space="preserve">
<value>1 день</value>
</data>
<data name="TimeSpanHumanize_SingleHour" xml:space="preserve">
<value>1 час</value>
</data>
<data name="TimeSpanHumanize_SingleMillisecond" xml:space="preserve">
<value>1 миллисекунда</value>
</data>
<data name="TimeSpanHumanize_SingleMinute" xml:space="preserve">
<value>1 минута</value>
</data>
<data name="TimeSpanHumanize_SingleMonth" xml:space="preserve">
<value>1 месяц</value>
</data>
<data name="TimeSpanHumanize_SingleSecond" xml:space="preserve">
<value>1 секунда</value>
</data>
<data name="TimeSpanHumanize_SingleWeek" xml:space="preserve">
<value>1 неделя</value>
</data>
<data name="TimeSpanHumanize_SingleYear" xml:space="preserve">
<value>1 год</value>
</data>
</root>