From 4d6a01559384827bf24fa8238216f69ec0ebecfb Mon Sep 17 00:00:00 2001 From: hangy Date: Thu, 1 Dec 2016 23:58:52 +0100 Subject: [PATCH] Squashed commit of the following: commit f9423deaa97b13f0766a8b06de5c67842114cfd1 Author: hangy Date: Thu Dec 1 20:48:01 2016 +0100 Update TimeSpanHumanizeTests.cs commit 2e5dfe5ae7546a242009b7c8aee730dc8ae17541 Author: hangy Date: Thu Dec 1 20:37:50 2016 +0100 Apparently I'm stupid and 7 days actually get humanized as 1 week. commit 152a119418776e75b1b3d23b1bdcc6b556dc3def Author: hangy Date: Wed Nov 30 23:50:51 2016 +0100 Workaround for unneeded suffix: Just use the same value. The reason for this workaround is that at the method that decides if the suffix should be applied, the information about the time unit is not available. So it would either need to do some string magic and explicitly exclude the "TimeSpanHumanize_MultipleDays" resource key from adding the postfix, or most of the `TimeSpan` formatting code would need to be rewriten for Croatian or modified for all languages to support Croatian. Neither seems reasonable for a quick change. commit 002cc7b558dcaa133e58b7c5e7b6656d70be8e82 Author: hangy Date: Wed Nov 30 23:12:57 2016 +0100 Added some more tests. From what I've read, all days should resolve to "dana" for the Croatian language. (No "_DualTrialQuadral" postfix.") commit c190e9da4c9946ba5748c157c5e91a79ccba745b Author: hangy Date: Tue Nov 22 00:29:51 2016 +0100 Add initial test for issue 597. --- .../Humanizer.Tests.Shared.projitems | 1 + .../Localisation/hr/TimeSpanHumanizeTests.cs | 22 +++++++++++++++++++ src/Humanizer/Properties/Resources.hr.resx | 5 ++++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/Humanizer.Tests.Shared/Localisation/hr/TimeSpanHumanizeTests.cs diff --git a/src/Humanizer.Tests.Shared/Humanizer.Tests.Shared.projitems b/src/Humanizer.Tests.Shared/Humanizer.Tests.Shared.projitems index 29a58cbd2..f571b971a 100644 --- a/src/Humanizer.Tests.Shared/Humanizer.Tests.Shared.projitems +++ b/src/Humanizer.Tests.Shared/Humanizer.Tests.Shared.projitems @@ -74,6 +74,7 @@ + diff --git a/src/Humanizer.Tests.Shared/Localisation/hr/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/hr/TimeSpanHumanizeTests.cs new file mode 100644 index 000000000..5cf5886dc --- /dev/null +++ b/src/Humanizer.Tests.Shared/Localisation/hr/TimeSpanHumanizeTests.cs @@ -0,0 +1,22 @@ +using System; +using Xunit; + +namespace Humanizer.Tests.Localisation.hr +{ + [UseCulture("hr-HR")] + public class TimeSpanHumanizeTests + { + [Theory] + [InlineData(1, "1 dan")] + [InlineData(2, "2 dana")] + [InlineData(3, "3 dana")] + [InlineData(4, "4 dana")] + [InlineData(5, "5 dana")] + [InlineData(7, "1 tjedan")] + [InlineData(14, "2 tjedna")] + public void Days(int days, string expected) + { + Assert.Equal(expected, TimeSpan.FromDays(days).Humanize()); + } + } +} diff --git a/src/Humanizer/Properties/Resources.hr.resx b/src/Humanizer/Properties/Resources.hr.resx index 8d7a0b703..436f13840 100644 --- a/src/Humanizer/Properties/Resources.hr.resx +++ b/src/Humanizer/Properties/Resources.hr.resx @@ -171,6 +171,9 @@ {0} dana + + {0} dana + {0} sati @@ -276,4 +279,4 @@ za godinu dana - \ No newline at end of file +