-
Notifications
You must be signed in to change notification settings - Fork 966
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from ErikSchierboom/dutch-localization
Made Dutch (NL) localization a neutral culture, not just for Belgium
- Loading branch information
Showing
5 changed files
with
207 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using Xunit; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.nl | ||
{ | ||
public class DateHumanizeTests : AmbientCulture | ||
{ | ||
public DateHumanizeTests() : base("nl-NL") { } | ||
|
||
[Theory] | ||
[InlineData(-10, "10 dagen geleden")] | ||
[InlineData(-3, "3 dagen geleden")] | ||
[InlineData(-2, "2 dagen geleden")] | ||
[InlineData(-1, "gisteren")] | ||
public void DaysAgo(int days, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddDays(days).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 uur geleden")] | ||
[InlineData(-3, "3 uur geleden")] | ||
[InlineData(-2, "2 uur geleden")] | ||
[InlineData(-1, "één uur geleden")] | ||
public void HoursAgo(int hours, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddHours(hours).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 minuten geleden")] | ||
[InlineData(-3, "3 minuten geleden")] | ||
[InlineData(-2, "2 minuten geleden")] | ||
[InlineData(-1, "één minuut geleden")] | ||
public void MinutesAgo(int minutes, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddMinutes(minutes).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 maanden geleden")] | ||
[InlineData(-3, "3 maanden geleden")] | ||
[InlineData(-2, "2 maanden geleden")] | ||
[InlineData(-1, "één maand geleden")] | ||
public void MonthsAgo(int months, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddMonths(months).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 seconden geleden")] | ||
[InlineData(-3, "3 seconden geleden")] | ||
[InlineData(-2, "2 seconden geleden")] | ||
[InlineData(-1, "één seconde geleden")] | ||
public void SecondsAgo(int seconds, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddSeconds(seconds).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 jaar geleden")] | ||
[InlineData(-3, "3 jaar geleden")] | ||
[InlineData(-2, "2 jaar geleden")] | ||
[InlineData(-1, "één jaar geleden")] | ||
public void YearsAgo(int years, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddYears(years).Humanize()); | ||
} | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
src/Humanizer.Tests/Localisation/nl/TimeSpanHumanizeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.nl | ||
{ | ||
public class TimeSpanHumanizeTests : AmbientCulture | ||
{ | ||
public TimeSpanHumanizeTests() : base("nl-NL") { } | ||
|
||
[Fact] | ||
public void TwoWeeks() | ||
{ | ||
Assert.Equal("2 weken", TimeSpan.FromDays(14).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneWeek() | ||
{ | ||
Assert.Equal("één week", TimeSpan.FromDays(7).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void SixDays() | ||
{ | ||
Assert.Equal("6 dagen", TimeSpan.FromDays(6).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoDays() | ||
{ | ||
Assert.Equal("2 dagen", TimeSpan.FromDays(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneDay() | ||
{ | ||
Assert.Equal("één dag", TimeSpan.FromDays(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoHours() | ||
{ | ||
Assert.Equal("2 uur", TimeSpan.FromHours(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneHour() | ||
{ | ||
Assert.Equal("één uur", TimeSpan.FromHours(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoMinutes() | ||
{ | ||
Assert.Equal("2 minuten", TimeSpan.FromMinutes(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneMinute() | ||
{ | ||
Assert.Equal("één minuut", TimeSpan.FromMinutes(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoSeconds() | ||
{ | ||
Assert.Equal("2 seconden", TimeSpan.FromSeconds(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneSecond() | ||
{ | ||
Assert.Equal("één seconde", TimeSpan.FromSeconds(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoMilliseconds() | ||
{ | ||
Assert.Equal("2 milliseconden", TimeSpan.FromMilliseconds(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneMillisecond() | ||
{ | ||
Assert.Equal("één milliseconde", TimeSpan.FromMilliseconds(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void NoTime() | ||
{ | ||
Assert.Equal("geen tijd", TimeSpan.Zero.Humanize()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters