From 87f81a0f1ef598aa4c516cc95fa7292b02f1e5f5 Mon Sep 17 00:00:00 2001 From: "c.jurek" Date: Fri, 18 Jan 2019 13:05:04 +0100 Subject: [PATCH] Updated/Corrected German localization for all single timespans with respective _Words-Values --- .../Localisation/de/TimeSpanHumanizeTests.cs | 88 +++++++++++++++++-- src/Humanizer/Properties/Resources.de.resx | 40 +++++++-- 2 files changed, 112 insertions(+), 16 deletions(-) diff --git a/src/Humanizer.Tests.Shared/Localisation/de/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/de/TimeSpanHumanizeTests.cs index c60c04e8c..393a91a3f 100644 --- a/src/Humanizer.Tests.Shared/Localisation/de/TimeSpanHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/de/TimeSpanHumanizeTests.cs @@ -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")] @@ -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")] @@ -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")] @@ -38,9 +60,19 @@ 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) { @@ -48,7 +80,15 @@ public void Days(int days, string expected) } [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) { @@ -56,16 +96,32 @@ public void Hours(int hours, string expected) } [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) { @@ -73,13 +129,29 @@ public void Seconds(int seconds, string expected) } [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() { diff --git a/src/Humanizer/Properties/Resources.de.resx b/src/Humanizer/Properties/Resources.de.resx index 87c3e700a..9a40f6eab 100644 --- a/src/Humanizer/Properties/Resources.de.resx +++ b/src/Humanizer/Properties/Resources.de.resx @@ -169,19 +169,19 @@ {0} Sekunden - Ein Tag + 1 Tag - Eine Stunde + 1 Stunde - Eine Millisekunde + 1 Millisekunde - Eine Minute + 1 Minute - Eine Sekunde + 1 Sekunde Keine Zeit @@ -190,7 +190,7 @@ {0} Wochen - Eine Woche + 1 Woche in {0} Tagen @@ -241,9 +241,33 @@ {0} Jahre - Ein Monat + 1 Monat - Ein Jahr + 1 Jahr + + + ein Tag + + + eine Stunde + + + eine Millisekunde + + + eine Minute + + + ein Monat + + + eine Sekunde + + + eine Woche + + + ein Jahr \ No newline at end of file