-
Notifications
You must be signed in to change notification settings - Fork 966
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
German translation #120
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 :)