Skip to content

Commit

Permalink
Merge pull request #778 from ChosyWan/master
Browse files Browse the repository at this point in the history
Updated/Corrected German localization for all single timespans with r…
  • Loading branch information
Oren Novotny authored Jan 18, 2019
2 parents 11bd9fd + 87f81a0 commit d5b3cf3
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class TimeSpanHumanizeTests

[Theory]
[Trait("Translation", "Native speaker")]
[InlineData(366, "Ein Jahr")]
[InlineData(366, "1 Jahr")]
[InlineData(731, "2 Jahre")]
[InlineData(1096, "3 Jahre")]
[InlineData(4018, "11 Jahre")]
Expand All @@ -19,7 +19,18 @@ public void Years(int days, string expected)

[Theory]
[Trait("Translation", "Native speaker")]
[InlineData(31, "Ein Monat")]
[InlineData(366, "ein Jahr")]
[InlineData(731, "zwei Jahre")]
[InlineData(1096, "drei Jahre")]
[InlineData(4018, "elf Jahre")]
public void YearsToWords(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Year,toWords:true));
}

[Theory]
[Trait("Translation", "Native speaker")]
[InlineData(31, "1 Monat")]
[InlineData(61, "2 Monate")]
[InlineData(92, "3 Monate")]
[InlineData(335, "11 Monate")]
Expand All @@ -29,7 +40,18 @@ public void Months(int days, string expected)
}

[Theory]
[InlineData(7, "Eine Woche")]
[Trait("Translation", "Native speaker")]
[InlineData(31, "ein Monat")]
[InlineData(61, "zwei Monate")]
[InlineData(92, "drei Monate")]
[InlineData(335, "elf Monate")]
public void MonthsToWords(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Year,toWords:true));
}

[Theory]
[InlineData(7, "1 Woche")]
[InlineData(14, "2 Wochen")]
[InlineData(21, "3 Wochen")]
[InlineData(77, "11 Wochen")]
Expand All @@ -38,48 +60,98 @@ public void Weeks(int days, string expected)
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize());
}

[Theory]
[InlineData(7, "eine Woche")]
[InlineData(14, "zwei Wochen")]
[InlineData(21, "drei Wochen")]
[InlineData(77, "elf Wochen")]
public void WeeksToWords(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(toWords: true));
}


[Theory]
[InlineData(1, "Ein Tag")]
[InlineData(1, "1 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(1, "ein Tag")]
[InlineData(2, "zwei Tage")]
public void DaysToWords(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(toWords: true));
}

[Theory]
[InlineData(1, "1 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(1, "eine Stunde")]
[InlineData(2, "zwei Stunden")]
public void HoursToWords(int hours, string expected)
{
Assert.Equal(expected, TimeSpan.FromHours(hours).Humanize(toWords: true));
}

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

[Theory]
[InlineData(1, "eine Minute")]
[InlineData(2, "zwei Minuten")]
public void MinutesToWords(int minutes, string expected)
{
Assert.Equal(expected, TimeSpan.FromMinutes(minutes).Humanize(toWords: true));
}


[Theory]
[InlineData(1, "Eine Sekunde")]
[InlineData(1, "1 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(1, "eine Sekunde")]
[InlineData(2, "zwei Sekunden")]
public void SecondsToWords(int seconds, string expected)
{
Assert.Equal(expected, TimeSpan.FromSeconds(seconds).Humanize(toWords: true));
}

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

[Theory]
[InlineData(1, "eine Millisekunde")]
[InlineData(2, "zwei Millisekunden")]
public void MillisecondsToWords(int milliseconds, string expected)
{
Assert.Equal(expected, TimeSpan.FromMilliseconds(milliseconds).Humanize(toWords: true));
}

[Fact]
public void NoTime()
{
Expand Down
40 changes: 32 additions & 8 deletions src/Humanizer/Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,19 @@
<value>{0} Sekunden</value>
</data>
<data name="TimeSpanHumanize_SingleDay" xml:space="preserve">
<value>Ein Tag</value>
<value>1 Tag</value>
</data>
<data name="TimeSpanHumanize_SingleHour" xml:space="preserve">
<value>Eine Stunde</value>
<value>1 Stunde</value>
</data>
<data name="TimeSpanHumanize_SingleMillisecond" xml:space="preserve">
<value>Eine Millisekunde</value>
<value>1 Millisekunde</value>
</data>
<data name="TimeSpanHumanize_SingleMinute" xml:space="preserve">
<value>Eine Minute</value>
<value>1 Minute</value>
</data>
<data name="TimeSpanHumanize_SingleSecond" xml:space="preserve">
<value>Eine Sekunde</value>
<value>1 Sekunde</value>
</data>
<data name="TimeSpanHumanize_Zero" xml:space="preserve">
<value>Keine Zeit</value>
Expand All @@ -190,7 +190,7 @@
<value>{0} Wochen</value>
</data>
<data name="TimeSpanHumanize_SingleWeek" xml:space="preserve">
<value>Eine Woche</value>
<value>1 Woche</value>
</data>
<data name="DateHumanize_MultipleDaysFromNow" xml:space="preserve">
<value>in {0} Tagen</value>
Expand Down Expand Up @@ -241,9 +241,33 @@
<value>{0} Jahre</value>
</data>
<data name="TimeSpanHumanize_SingleMonth" xml:space="preserve">
<value>Ein Monat</value>
<value>1 Monat</value>
</data>
<data name="TimeSpanHumanize_SingleYear" xml:space="preserve">
<value>Ein Jahr</value>
<value>1 Jahr</value>
</data>
<data name="TimeSpanHumanize_SingleDay_Words" xml:space="preserve">
<value>ein Tag</value>
</data>
<data name="TimeSpanHumanize_SingleHour_Words" xml:space="preserve">
<value>eine Stunde</value>
</data>
<data name="TimeSpanHumanize_SingleMillisecond_Words" xml:space="preserve">
<value>eine Millisekunde</value>
</data>
<data name="TimeSpanHumanize_SingleMinute_Words" xml:space="preserve">
<value>eine Minute</value>
</data>
<data name="TimeSpanHumanize_SingleMonth_Words" xml:space="preserve">
<value>ein Monat</value>
</data>
<data name="TimeSpanHumanize_SingleSecond_Words" xml:space="preserve">
<value>eine Sekunde</value>
</data>
<data name="TimeSpanHumanize_SingleWeek_Words" xml:space="preserve">
<value>eine Woche</value>
</data>
<data name="TimeSpanHumanize_SingleYear_Words" xml:space="preserve">
<value>ein Jahr</value>
</data>
</root>

0 comments on commit d5b3cf3

Please sign in to comment.