Skip to content

Commit

Permalink
Merge pull request #109 from ErikSchierboom/dutch-localization
Browse files Browse the repository at this point in the history
Made Dutch (NL) localization a neutral culture, not just for Belgium
  • Loading branch information
MehdiK committed Mar 28, 2014
2 parents 6cb71e3 + 1f1875d commit cd28253
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
<Compile Include="Localisation\DateHumanizeTests.nb-NO.cs" />
<Compile Include="Localisation\es\DateHumanizeTests.cs" />
<Compile Include="Localisation\es\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\nl\DateHumanizeTests.cs" />
<Compile Include="Localisation\nl\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\pt-BR\DateHumanizeTests.cs" />
<Compile Include="Localisation\pt-BR\TimeSpanHumanizeTests.cs" />
<Compile Include="ResourceKeyTests.cs" />
Expand Down
71 changes: 71 additions & 0 deletions src/Humanizer.Tests/Localisation/nl/DateHumanizeTests.cs
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 src/Humanizer.Tests/Localisation/nl/TimeSpanHumanizeTests.cs
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());
}
}
}
2 changes: 1 addition & 1 deletion src/Humanizer/Humanizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<EmbeddedResource Include="Properties\Resources.ru.resx" />
<EmbeddedResource Include="Properties\Resources.ar.resx" />
<EmbeddedResource Include="Properties\Resources.fr.resx" />
<EmbeddedResource Include="Properties\Resources.nl-BE.resx" />
<EmbeddedResource Include="Properties\Resources.nl.resx" />
<EmbeddedResource Include="Properties\Resources.resx" />
<EmbeddedResource Include="Properties\Resources.ro.resx" />
<EmbeddedResource Include="Properties\Resources.pt-BR.resx" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,43 @@
<data name="DateHumanize_MultipleYearsAgo" xml:space="preserve">
<value>{0} jaar geleden</value>
</data>
<data name="TimeSpanHumanize_MultipleDays" xml:space="preserve">
<value>{0} dagen</value>
</data>
<data name="TimeSpanHumanize_MultipleHours" xml:space="preserve">
<value>{0} uur</value>
</data>
<data name="TimeSpanHumanize_MultipleMilliseconds" xml:space="preserve">
<value>{0} milliseconden</value>
</data>
<data name="TimeSpanHumanize_MultipleMinutes" xml:space="preserve">
<value>{0} minuten</value>
</data>
<data name="TimeSpanHumanize_MultipleSeconds" xml:space="preserve">
<value>{0} seconden</value>
</data>
<data name="TimeSpanHumanize_MultipleWeeks" xml:space="preserve">
<value>{0} weken</value>
</data>
<data name="TimeSpanHumanize_SingleDay" xml:space="preserve">
<value>één dag</value>
</data>
<data name="TimeSpanHumanize_SingleHour" xml:space="preserve">
<value>één uur</value>
</data>
<data name="TimeSpanHumanize_SingleMillisecond" xml:space="preserve">
<value>één milliseconde</value>
</data>
<data name="TimeSpanHumanize_SingleMinute" xml:space="preserve">
<value>één minuut</value>
</data>
<data name="TimeSpanHumanize_SingleSecond" xml:space="preserve">
<value>één seconde</value>
</data>
<data name="TimeSpanHumanize_SingleWeek" xml:space="preserve">
<value>één week</value>
</data>
<data name="TimeSpanHumanize_Zero" xml:space="preserve">
<value>geen tijd</value>
</data>
</root>

0 comments on commit cd28253

Please sign in to comment.