Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit f9423de
Author: hangy <hangy@hangy.de>
Date:   Thu Dec 1 20:48:01 2016 +0100

    Update TimeSpanHumanizeTests.cs

commit 2e5dfe5
Author: hangy <hangy@hangy.de>
Date:   Thu Dec 1 20:37:50 2016 +0100

    Apparently I'm stupid and 7 days actually get humanized as 1 week.

commit 152a119
Author: hangy <hangy@hangy.de>
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 002cc7b
Author: hangy <hangy@hangy.de>
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 c190e9d
Author: hangy <hangy@hangy.de>
Date:   Tue Nov 22 00:29:51 2016 +0100

    Add initial test for issue 597.
  • Loading branch information
hangy committed Dec 1, 2016
1 parent 289f97f commit 4d6a015
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Localisation\he\NumberToWordsTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\he\TimeSpanHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\hr\DateHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\hr\TimeSpanHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\hu\DateHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\hu\TimeSpanHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\id\DateHumanizeTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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());
}
}
}
5 changes: 4 additions & 1 deletion src/Humanizer/Properties/Resources.hr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@
<data name="TimeSpanHumanize_MultipleDays" xml:space="preserve">
<value>{0} dana</value>
</data>
<data name="TimeSpanHumanize_MultipleDays_DualTrialQuadral" xml:space="preserve">
<value>{0} dana</value>
</data>
<data name="TimeSpanHumanize_MultipleHours" xml:space="preserve">
<value>{0} sati</value>
</data>
Expand Down Expand Up @@ -276,4 +279,4 @@
<data name="DateHumanize_SingleYearFromNow" xml:space="preserve">
<value>za godinu dana</value>
</data>
</root>
</root>

0 comments on commit 4d6a015

Please sign in to comment.