Skip to content

Commit

Permalink
Merge pull request #637 from cristianst85/timespan-fixes-ro
Browse files Browse the repository at this point in the history
Timespan fixes for Romanian (ref. #632)
  • Loading branch information
Oren Novotny authored Nov 3, 2017
2 parents fdaa323 + affe723 commit 83d076f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ public void SecondsAgo(int seconds, string expected)
[Theory]
[InlineData(10, "acum 10 zile")]
[InlineData(23, "acum 23 de zile")]
public void DaysAgo(int seconds, string expected)
public void DaysAgo(int days, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Day, Tense.Past);
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past);
}

[Theory]
[InlineData(119, "acum 119 ani")]
[InlineData(100, "acum 100 de ani")]
public void YearsAgo(int seconds, string expected)
public void YearsAgo(int years, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Year, Tense.Past);
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past);
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ public class TimeSpanHumanizerTests
[InlineData(14, "14 milisecunde")]
[InlineData(21, "21 de milisecunde")]
[InlineData(3000, "3 secunde")]
public void Milliseconds(int millisSeconds, string expected)
public void Milliseconds(int milliseconds, string expected)
{
var actual = TimeSpan.FromMilliseconds(millisSeconds).Humanize();
var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize();
Assert.Equal(expected, actual);
}

[Theory]
[InlineData(0, "0 secunde")]
[InlineData(1, "1 secundă")]
[InlineData(14, "14 secunde")]
[InlineData(21, "21 de secunde")]
Expand Down Expand Up @@ -83,7 +84,7 @@ public void Weeks(int weeks, string expected)

[Theory]
[Trait("Translation", "Native speaker")]
[InlineData(31, "1 luna")]
[InlineData(31, "1 lună")]
[InlineData(61, "2 luni")]
[InlineData(92, "3 luni")]
[InlineData(335, "11 luni")]
Expand All @@ -98,9 +99,18 @@ public void Months(int days, string expected)
[InlineData(731, "2 ani")]
[InlineData(1096, "3 ani")]
[InlineData(4018, "11 ani")]
[InlineData(7500, "20 de ani")]
public void Years(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Year));
}

[Fact, CustomDescription("The name of this test is confusing because has no sense. Instead should be read as an interval with duration zero and not the absence of time.")]
public void NoTime()
{
// Usage in Romanian: "Timp execuție: 0 secunde."
// Should be equivalent with TimeSpan.FromSeconds(0).Humanize()
Assert.Equal("0 secunde", TimeSpan.Zero.Humanize());
}
}
}
4 changes: 2 additions & 2 deletions src/Humanizer/Properties/Resources.ro.resx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
<value>1 săptămână</value>
</data>
<data name="TimeSpanHumanize_Zero" xml:space="preserve">
<value>niciun timp</value>
<value>0 secunde</value>
</data>
<data name="TimeSpanHumanize_MultipleMonths" xml:space="preserve">
<value>{0}{1} luni</value>
Expand All @@ -238,7 +238,7 @@
<value>{0}{1} ani</value>
</data>
<data name="TimeSpanHumanize_SingleMonth" xml:space="preserve">
<value>1 luna</value>
<value>1 lună</value>
</data>
<data name="TimeSpanHumanize_SingleYear" xml:space="preserve">
<value>1 an</value>
Expand Down

0 comments on commit 83d076f

Please sign in to comment.