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

German translation #120

Merged
merged 1 commit into from
Apr 2, 2014
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
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
###In Development
- [#120](https://github.com/MehdiK/Humanizer/pull/120): Added translation for culture 'de'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for adding this. This doesn't happen often :)


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

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 @@ -79,6 +79,8 @@
<Compile Include="Localisation\ar\NumberToWordsTests.cs" />
<Compile Include="Localisation\ar\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\DateHumanizeTests.nb-NO.cs" />
<Compile Include="Localisation\de\DateHumanizeTests.cs" />
<Compile Include="Localisation\de\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\es\DateHumanizeTests.cs" />
<Compile Include="Localisation\es\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\nl\DateHumanizeTests.cs" />
Expand Down
119 changes: 119 additions & 0 deletions src/Humanizer.Tests/Localisation/de/DateHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using System;
using Xunit;
using Xunit.Extensions;

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

[Theory]
[InlineData(-10, "vor 10 Tagen")]
[InlineData(-3, "vor 3 Tagen")]
[InlineData(-2, "vor 2 Tagen")]
[InlineData(-1, "gestern")]
public void DaysAgo(int days, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddDays(days).Humanize());
}

[Theory]
[InlineData(2, "in 2 Tagen")]
[InlineData(1, "morgen")]
public void InDays(int days, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddDays(days).Humanize());
}

[Theory]
[InlineData(-10, "vor 10 Stunden")]
[InlineData(-3, "vor 3 Stunden")]
[InlineData(-2, "vor 2 Stunden")]
[InlineData(-1, "vor einer Stunde")]
public void HoursAgo(int hours, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddHours(hours).Humanize());
}

[Theory]
[InlineData(2, "in 2 Stunden")]
[InlineData(1, "in einer Stunde")]
public void InHours(int hours, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddHours(hours).Humanize());
}

[Theory]
[InlineData(-10, "vor 10 Minuten")]
[InlineData(-3, "vor 3 Minuten")]
[InlineData(-2, "vor 2 Minuten")]
[InlineData(-1, "vor einer Minute")]
public void MinutesAgo(int minutes, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddMinutes(minutes).Humanize());
}

[Theory]
[InlineData(2, "in 2 Minuten")]
[InlineData(1, "in einer Minute")]
public void InMinutes(int minutes, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddMinutes(minutes).Humanize());
}

[Theory]
[InlineData(-10, "vor 10 Monaten")]
[InlineData(-3, "vor 3 Monaten")]
[InlineData(-2, "vor 2 Monaten")]
[InlineData(-1, "vor einem Monat")]
public void MonthsAgo(int months, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddMonths(months).Humanize());
}

[Theory]
[InlineData(2, "in 2 Monaten")]
[InlineData(1, "in einem Monat")]
public void InMonths(int months, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddMonths(months).Humanize());
}

[Theory]
[InlineData(-10, "vor 10 Sekunden")]
[InlineData(-3, "vor 3 Sekunden")]
[InlineData(-2, "vor 2 Sekunden")]
[InlineData(-1, "vor einer Sekunde")]
public void SecondsAgo(int seconds, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddSeconds(seconds).Humanize());
}

[Theory]
[InlineData(2, "in 2 Sekunden")]
[InlineData(1, "in einer Sekunde")]
public void InSeconds(int seconds, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddSeconds(seconds).Humanize());
}

[Theory]
[InlineData(-10, "vor 10 Jahren")]
[InlineData(-3, "vor 3 Jahren")]
[InlineData(-2, "vor 2 Jahren")]
[InlineData(-1, "vor einem Jahr")]
public void YearsAgo(int years, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddYears(years).Humanize());
}

[Theory]
[InlineData(2, "in 2 Jahren")]
[InlineData(1, "in einem Jahr")]
public void InYears(int years, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddYears(years).Humanize());
}
}
}
70 changes: 70 additions & 0 deletions src/Humanizer.Tests/Localisation/de/TimeSpanHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using Xunit;
using Xunit.Extensions;

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

[Theory]
[InlineData(7, "Eine Woche")]
[InlineData(14, "2 Wochen")]
[InlineData(21, "3 Wochen")]
[InlineData(77, "11 Wochen")]
public void Weeks(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize());
}


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

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

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


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

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

[Fact]
public void NoTime()
{
// This one doesn't make a lot of sense but ... w/e
Assert.Equal("Keine Zeit", 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 @@ -149,6 +149,7 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.de.resx" />
<EmbeddedResource Include="Properties\Resources.nb-NO.resx" />
<EmbeddedResource Include="Properties\Resources.af.resx" />
<EmbeddedResource Include="Properties\Resources.fr-BE.resx" />
Expand Down
Loading