-
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 #120 from ccellar/PR/LocDE
German translation
- Loading branch information
Showing
6 changed files
with
427 additions
and
0 deletions.
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
119 changes: 119 additions & 0 deletions
119
src/Humanizer.Tests/Localisation/de/DateHumanizeTests.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,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
70
src/Humanizer.Tests/Localisation/de/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,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()); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.