Skip to content

Commit

Permalink
Merge branch 'clean-czech'
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiK committed Apr 6, 2014
2 parents bd16448 + b93b828 commit af56c1a
Show file tree
Hide file tree
Showing 9 changed files with 558 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<Compile Include="Bytes\ParsingTests.cs" />
<Compile Include="Bytes\ToStringTests.cs" />
<Compile Include="CasingTests.cs" />
<Compile Include="Localisation\cs\DateHumanizeTests.cs" />
<Compile Include="Localisation\cs\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\sk\DateHumanizeTests.cs" />
<Compile Include="Localisation\ar\DateHumanizeTests.cs" />
<Compile Include="Localisation\ar\NumberToWordsTests.cs" />
Expand Down
168 changes: 168 additions & 0 deletions src/Humanizer.Tests/Localisation/cs/DateHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
using System;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.cs
{
public class DateHumanizeTests : AmbientCulture
{
public DateHumanizeTests()
: base("cs-CZ")
{
}

[Theory]
[InlineData(1, "za sekundu")]
[InlineData(2, "za 2 sekundy")]
[InlineData(3, "za 3 sekundy")]
[InlineData(4, "za 4 sekundy")]
[InlineData(5, "za 5 sekund")]
[InlineData(6, "za 6 sekund")]
[InlineData(10, "za 10 sekund")]
public void SecondsFromNow(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddSeconds(number).Humanize());
}

[Theory]
[InlineData(1, "za minutu")]
[InlineData(2, "za 2 minuty")]
[InlineData(3, "za 3 minuty")]
[InlineData(4, "za 4 minuty")]
[InlineData(5, "za 5 minut")]
[InlineData(6, "za 6 minut")]
[InlineData(10, "za 10 minut")]
public void MinutesFromNow(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddMinutes(number).Humanize());
}

[Theory]
[InlineData(1, "za hodinu")]
[InlineData(2, "za 2 hodiny")]
[InlineData(3, "za 3 hodiny")]
[InlineData(4, "za 4 hodiny")]
[InlineData(5, "za 5 hodin")]
[InlineData(6, "za 6 hodin")]
[InlineData(10, "za 10 hodin")]
public void HoursFromNow(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddHours(number).Humanize());
}

[Theory]
[InlineData(1, "zítra")]
[InlineData(2, "za 2 dny")]
[InlineData(3, "za 3 dny")]
[InlineData(4, "za 4 dny")]
[InlineData(9, "za 9 dnů")]
[InlineData(10, "za 10 dnů")]
public void DayFromNow(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddDays(number).Humanize());
}

[Theory]
[InlineData(1, "za měsíc")]
[InlineData(2, "za 2 měsíce")]
[InlineData(3, "za 3 měsíce")]
[InlineData(4, "za 4 měsíce")]
[InlineData(5, "za 5 měsíců")]
[InlineData(6, "za 6 měsíců")]
[InlineData(10, "za 10 měsíců")]
public void MonthsFromNow(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddMonths(number).Humanize());
}

[Theory]
[InlineData(1, "za rok")]
[InlineData(2, "za 2 roky")]
[InlineData(3, "za 3 roky")]
[InlineData(4, "za 4 roky")]
[InlineData(5, "za 5 let")]
[InlineData(6, "za 6 let")]
[InlineData(10, "za 10 let")]
public void YearsFromNow(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddYears(number).Humanize());
}

[Theory]
[InlineData(1, "před sekundou")]
[InlineData(2, "před 2 sekundami")]
[InlineData(3, "před 3 sekundami")]
[InlineData(4, "před 4 sekundami")]
[InlineData(5, "před 5 sekundami")]
[InlineData(6, "před 6 sekundami")]
[InlineData(10, "před 10 sekundami")]
public void SecondsAgo(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddSeconds(-1 * number).Humanize());
}

[Theory]
[InlineData(1, "před minutou")]
[InlineData(2, "před 2 minutami")]
[InlineData(3, "před 3 minutami")]
[InlineData(4, "před 4 minutami")]
[InlineData(5, "před 5 minutami")]
[InlineData(6, "před 6 minutami")]
[InlineData(10, "před 10 minutami")]
public void MinutesAgo(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddMinutes(-1 * number).Humanize());
}

[Theory]
[InlineData(1, "před hodinou")]
[InlineData(2, "před 2 hodinami")]
[InlineData(3, "před 3 hodinami")]
[InlineData(4, "před 4 hodinami")]
[InlineData(5, "před 5 hodinami")]
[InlineData(6, "před 6 hodinami")]
[InlineData(10, "před 10 hodinami")]
public void HoursAgo(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddHours(-1 * number).Humanize());
}

[Theory]
[InlineData(1, "včera")]
[InlineData(2, "před 2 dny")]
[InlineData(3, "před 3 dny")]
[InlineData(4, "před 4 dny")]
[InlineData(9, "před 9 dny")]
[InlineData(10, "před 10 dny")]
public void DayAgo(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddDays(-1 * number).Humanize());
}

[Theory]
[InlineData(1, "před měsícem")]
[InlineData(2, "před 2 měsíci")]
[InlineData(3, "před 3 měsíci")]
[InlineData(4, "před 4 měsíci")]
[InlineData(5, "před 5 měsíci")]
[InlineData(6, "před 6 měsíci")]
[InlineData(10, "před 10 měsíci")]
public void MonthsAgo(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddMonths(-1 * number).Humanize());
}

[Theory]
[InlineData(1, "před rokem")]
[InlineData(2, "před 2 lety")]
[InlineData(3, "před 3 lety")]
[InlineData(4, "před 4 lety")]
[InlineData(5, "před 5 lety")]
[InlineData(6, "před 6 lety")]
[InlineData(10, "před 10 lety")]
public void YearsAgo(int number, string expected)
{
Assert.Equal(expected, DateTime.UtcNow.AddYears(-1 * number).Humanize());
}
}
}
90 changes: 90 additions & 0 deletions src/Humanizer.Tests/Localisation/cs/TimeSpanHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using System;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.cs
{
public class TimeSpanHumanizeTests : AmbientCulture
{
public TimeSpanHumanizeTests()
: base("cs-CZ")
{
}

[Theory]
[InlineData(1, "1 milisekunda")]
[InlineData(2, "2 milisekundy")]
[InlineData(3, "3 milisekundy")]
[InlineData(4, "4 milisekundy")]
[InlineData(5, "5 milisekund")]
[InlineData(6, "6 milisekund")]
[InlineData(10, "10 milisekund")]
public void Milliseconds(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromMilliseconds(number).Humanize());
}

[Theory]
[InlineData(1, "1 sekunda")]
[InlineData(2, "2 sekundy")]
[InlineData(3, "3 sekundy")]
[InlineData(4, "4 sekundy")]
[InlineData(5, "5 sekund")]
[InlineData(6, "6 sekund")]
[InlineData(10, "10 sekund")]
public void Seconds(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromSeconds(number).Humanize());
}

[Theory]
[InlineData(1, "1 minuta")]
[InlineData(2, "2 minuty")]
[InlineData(3, "3 minuty")]
[InlineData(4, "4 minuty")]
[InlineData(5, "5 minut")]
[InlineData(6, "6 minut")]
[InlineData(10, "10 minut")]
public void Minutes(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromMinutes(number).Humanize());
}

[Theory]
[InlineData(1, "1 hodina")]
[InlineData(2, "2 hodiny")]
[InlineData(3, "3 hodiny")]
[InlineData(4, "4 hodiny")]
[InlineData(5, "5 hodin")]
[InlineData(6, "6 hodin")]
[InlineData(10, "10 hodin")]
public void Hours(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromHours(number).Humanize());
}

[Theory]
[InlineData(1, "1 den")]
[InlineData(2, "2 dny")]
[InlineData(3, "3 dny")]
[InlineData(4, "4 dny")]
[InlineData(5, "5 dnů")]
[InlineData(6, "6 dnů")]
public void Days(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(number).Humanize());
}

[Theory]
[InlineData(1, "1 týden")]
[InlineData(2, "2 týdny")]
[InlineData(3, "3 týdny")]
[InlineData(4, "4 týdny")]
[InlineData(5, "5 týdnů")]
[InlineData(6, "6 týdnů")]
public void Weeks(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(number*7).Humanize());
}
}
}
4 changes: 2 additions & 2 deletions src/Humanizer.Tests/Localisation/sk/DateHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Humanizer.Tests.Localisation.sk
{
public class DateTimeHumanizeTests : AmbientCulture
public class DateHumanizeTests : AmbientCulture
{
public DateTimeHumanizeTests()
public DateHumanizeTests()
: base("sk-SK")
{
}
Expand Down
4 changes: 1 addition & 3 deletions src/Humanizer.Tests/Localisation/sk/TimeSpanHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public TimeSpanHumanizeTests()
[InlineData(5, "5 milisekúnd")]
[InlineData(6, "6 milisekúnd")]
[InlineData(10, "10 milisekúnd")]
public void Miliseconds(int number, string expected)
public void Milliseconds(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromMilliseconds(number).Humanize());
}
Expand Down Expand Up @@ -86,7 +86,5 @@ public void Weeks(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(number * 7).Humanize());
}


}
}
3 changes: 2 additions & 1 deletion src/Humanizer/Configuration/Configurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public static class Configurator
{ "ro", () => new RomanianFormatter() },
{ "ru", () => new RussianFormatter() },
{ "ar", () => new ArabicFormatter() },
{ "sk", () => new SlovakFormatter() }
{ "sk", () => new CzechSlovakFormatter() },
{ "cs", () => new CzechSlovakFormatter() }
};

/// <summary>
Expand Down
11 changes: 4 additions & 7 deletions src/Humanizer/Humanizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<Compile Include="CasingExtensions.cs" />
<Compile Include="Configuration\Configurator.cs" />
<Compile Include="DateHumanizeExtensions.cs" />
<Compile Include="Localisation\SlovakFormatter.cs" />
<Compile Include="Localisation\CzechSlovakFormatter.cs" />
<Compile Include="Localisation\TimeUnitTense.cs" />
<Compile Include="TimeSpanHumanizeExtensions.cs" />
<Compile Include="FluentDate\In.SomeTimeFrom.cs">
Expand Down Expand Up @@ -145,6 +145,7 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.cs.resx" />
<EmbeddedResource Include="Properties\Resources.de.resx" />
<EmbeddedResource Include="Properties\Resources.fa.resx" />
<EmbeddedResource Include="Properties\Resources.nb-NO.resx" />
Expand All @@ -154,17 +155,13 @@
<EmbeddedResource Include="Properties\Resources.es.resx" />
<EmbeddedResource Include="Properties\Resources.el.resx" />
<EmbeddedResource Include="Properties\Resources.ru.resx" />
<EmbeddedResource Include="Properties\Resources.ar.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.ar.resx" />
<EmbeddedResource Include="Properties\Resources.fr.resx" />
<EmbeddedResource Include="Properties\Resources.nl.resx" />
<EmbeddedResource Include="Properties\Resources.resx" />
<EmbeddedResource Include="Properties\Resources.ro.resx" />
<EmbeddedResource Include="Properties\Resources.pt-BR.resx" />
<EmbeddedResource Include="Properties\Resources.sk.resx">
<LastGenOutput>Resources.sk.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.sk.resx" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Humanizer.Localisation
{
internal class SlovakFormatter : DefaultFormatter
internal class CzechSlovakFormatter : DefaultFormatter
{
private const string PaucalPostfix = "_Paucal";

Expand Down
Loading

0 comments on commit af56c1a

Please sign in to comment.