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

Danish translation #144

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 2 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
###In Development

- [#144](https://github.com/MehdiK/Humanizer/pull/144): Danish localization (strings, tests)

[Commits](https://github.com/MehdiK/Humanizer/compare/v1.18.1...master)

###v1.18.1 - 2014-04-09
Expand Down
2 changes: 2 additions & 0 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
<Compile Include="DateHumanize.cs" />
<Compile Include="Localisation\cs\DateHumanizeTests.cs" />
<Compile Include="Localisation\cs\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\da\DateHumanizeTests.cs" />
<Compile Include="Localisation\da\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\nb-NO\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\pl\DateHumanizeTests.cs" />
<Compile Include="Localisation\pl\TimeSpanHumanizeTests.cs" />
Expand Down
136 changes: 136 additions & 0 deletions src/Humanizer.Tests/Localisation/da/DateHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
using Humanizer.Localisation;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.da
{
public class DateHumanizeTests : AmbientCulture
{
public DateHumanizeTests() : base("da-DK") { }

[Theory]
[InlineData(-10, "10 dage siden")]
[InlineData(-3, "3 dage siden")]
[InlineData(-2, "2 dage siden")]
[InlineData(-1, "i går")]
public void DaysAgo(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past);
}

[Theory]
[InlineData(1, "i morgen")]
[InlineData(10, "10 dage fra nu")]
[InlineData(28, "28 dage fra nu")]
[InlineData(32, "en måned fra nu")]
public void DaysFromNow(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future);
}

[Theory]
[InlineData(1, "et sekund fra nu")]
[InlineData(10, "10 sekunder fra nu")]
[InlineData(59, "59 sekunder fra nu")]
[InlineData(60, "et minut fra nu")]
public void SecondsFromNow(int seconds, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future);
}

[Theory]
[InlineData(-10, "10 timer siden")]
[InlineData(-3, "3 timer siden")]
[InlineData(-2, "2 timer siden")]
[InlineData(-1, "en time siden")]
public void HoursAgo(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past);
}

[Theory]
[InlineData(1, "en time fra nu")]
[InlineData(10, "10 timer fra nu")]
[InlineData(23, "23 timer fra nu")]
[InlineData(24, "i morgen")]
public void HoursFromNow(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future);
}

[Theory]
[InlineData(-10, "10 minutter siden")]
[InlineData(-3, "3 minutter siden")]
[InlineData(-2, "2 minutter siden")]
[InlineData(-1, "et minut siden")]
public void MinutesAgo(int minutes, string expected)
{
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past);
}

[Theory]
[InlineData(1, "et minut fra nu")]
[InlineData(10, "10 minutter fra nu")]
[InlineData(44, "44 minutter fra nu")]
[InlineData(45, "en time fra nu")]
[InlineData(119, "en time fra nu")]
[InlineData(120, "2 timer fra nu")]
public void MinutesFromNow(int minutes, string expected)
{
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future);
}
[Theory]
[InlineData(-10, "10 måneder siden")]
[InlineData(-3, "3 måneder siden")]
[InlineData(-2, "2 måneder siden")]
[InlineData(-1, "en måned siden")]
public void MonthsAgo(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past);
}

[Theory]
[InlineData(1, "en måned fra nu")]
[InlineData(10, "10 måneder fra nu")]
[InlineData(11, "11 måneder fra nu")]
[InlineData(12, "et år fra nu")]
public void MonthsFromNow(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future);
}

[Theory]
[InlineData(-10, "10 sekunder siden")]
[InlineData(-3, "3 sekunder siden")]
[InlineData(-2, "2 sekunder siden")]
[InlineData(-1, "et sekund siden")]
public void SecondsAgo(int seconds, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past);
}

[Theory]
[InlineData(-10, "10 år siden")]
[InlineData(-3, "3 år siden")]
[InlineData(-2, "2 år siden")]
[InlineData(-1, "et år siden")]
public void YearsAgo(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past);
}

[Theory]
[InlineData(1, "et år fra nu")]
[InlineData(2, "2 år fra nu")]
public void YearsFromNow(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future);
}

[Theory]
[InlineData(0, "nu")]
public void Now(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future);
}
}
}
65 changes: 65 additions & 0 deletions src/Humanizer.Tests/Localisation/da/TimeSpanHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.da
{
public class TimeSpanHumanizeTests : AmbientCulture
{
public TimeSpanHumanizeTests() : base("da-DK") { }

[Theory]
[InlineData(7, "en uge")]
[InlineData(14, "2 uger")]
public void Weeks(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize());
}

[Theory]
[InlineData(1, "en dag")]
[InlineData(2, "2 dage")]
public void Days(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize());
}

[Theory]
[InlineData(1, "en time")]
[InlineData(2, "2 timer")]
public void Hours(int hours, string expected)
{
Assert.Equal(expected, TimeSpan.FromHours(hours).Humanize());
}

[Theory]
[InlineData(1, "et minut")]
[InlineData(2, "2 minutter")]
public void Minutes(int minutes, string expected)
{
Assert.Equal(expected, TimeSpan.FromMinutes(minutes).Humanize());
}

[Theory]
[InlineData(1, "et sekund")]
[InlineData(2, "2 sekunder")]
public void Seconds(int seconds, string expected)
{
Assert.Equal(expected, TimeSpan.FromSeconds(seconds).Humanize());
}

[Theory]
[InlineData(1, "et millisekund")]
[InlineData(2, "2 millisekunder")]
public void Milliseconds(int milliseconds, string expected)
{
Assert.Equal(expected, TimeSpan.FromMilliseconds(milliseconds).Humanize());
}

[Fact]
public void NoTime()
{
Assert.Equal("ingen tid", TimeSpan.Zero.Humanize());
}
}
}
1 change: 1 addition & 0 deletions src/Humanizer/Humanizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.da.resx" />
<EmbeddedResource Include="Properties\Resources.pl.resx" />
<EmbeddedResource Include="Properties\Resources.cs.resx" />
<EmbeddedResource Include="Properties\Resources.de.resx" />
Expand Down
Loading