Skip to content

Commit

Permalink
Merge branch 'Swedish'
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiK committed Apr 9, 2014
2 parents 1ad78fc + 6914efd commit 2119bc2
Show file tree
Hide file tree
Showing 6 changed files with 410 additions and 0 deletions.
2 changes: 2 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
###In Development

- [#135](https://github.com/MehdiK/Humanizer/pull/135): Swedish localization (strings, tests)

[Commits](https://github.com/MehdiK/Humanizer/compare/v1.17.1...master)

###v1.17.1 - 2014-04-06
Expand Down
2 changes: 2 additions & 0 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
<Compile Include="Localisation\pt-BR\DateHumanizeTests.cs" />
<Compile Include="Localisation\pt-BR\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\sk\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\sv\DateHumanizeTests.cs" />
<Compile Include="Localisation\sv\TimeSpanHumanizeTests.cs" />
<Compile Include="ResourceKeyTests.cs" />
<Compile Include="RomanNumeralTests.cs" />
<Compile Include="StringExtensionsTests.cs" />
Expand Down
109 changes: 109 additions & 0 deletions src/Humanizer.Tests/Localisation/sv/DateHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
using Humanizer.Localisation;
using Xunit.Extensions;

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

[Theory]
[InlineData(1, "om en sekund")]
[InlineData(2, "om 2 sekunder")]
public void SecondsFromNow(int seconds, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future);
}

[Theory]
[InlineData(1, "om en minut")]
[InlineData(2, "om 2 minuter")]
public void MinutesFromNow(int minutes, string expected)
{
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future);
}

[Theory]
[InlineData(1, "om en timme")]
[InlineData(2, "om 2 timmar")]
public void HoursFromNow(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future);
}

[Theory]
[InlineData(1, "i morgon")]
[InlineData(2, "om 2 dagar")]
public void DayFromNow(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future);
}

[Theory]
[InlineData(1, "om en månad")]
[InlineData(2, "om 2 månader")]
public void MonthsFromNow(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future);
}

[Theory]
[InlineData(1, "om ett år")]
[InlineData(2, "om 2 år")]
public void YearsFromNow(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future);
}

[Theory]
[InlineData(1, "en sekund sedan")]
[InlineData(2, "för 2 sekunder sedan")]
public void SecondsAgo(int seconds, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past);
}

[Theory]
[InlineData(1, "en minut sedan")]
[InlineData(2, "för 2 minuter sedan")]
public void MinutesAgo(int minutes, string expected)
{
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past);
}

[Theory]
[InlineData(1, "en timme sedan")]
[InlineData(2, "för 2 timmar sedan")]
public void HoursAgo(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past);
}

[Theory]
[InlineData(1, "igår")]
[InlineData(2, "för 2 dagar sedan")]
public void DayAgo(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past);
}

[Theory]
[InlineData(1, "en månad sedan")]
[InlineData(2, "för 2 månader sedan")]
public void MonthsAgo(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past);
}

[Theory]
[InlineData(1, "ett år sedan")]
[InlineData(2, "för 2 år sedan")]
public void YearsAgo(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past);
}
}
}
62 changes: 62 additions & 0 deletions src/Humanizer.Tests/Localisation/sv/TimeSpanHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using Xunit;
using Xunit.Extensions;

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

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

[Theory]
[InlineData(1, "1 sekund")]
[InlineData(2, "2 sekunder")]
public void Seconds(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromSeconds(number).Humanize());
}

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

[Theory]
[InlineData(1, "1 timma")]
[InlineData(2, "2 timmar")]
public void Hours(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromHours(number).Humanize());
}

[Theory]
[InlineData(1, "1 dag")]
[InlineData(2, "2 dagar")]
public void Days(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(number).Humanize());
}

[Theory]
[InlineData(1, "1 vecka")]
[InlineData(2, "2 veckor")]
public void Weeks(int number, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(number * 7).Humanize());
}
}
}
1 change: 1 addition & 0 deletions src/Humanizer/Humanizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<EmbeddedResource Include="Properties\Resources.ro.resx" />
<EmbeddedResource Include="Properties\Resources.pt-BR.resx" />
<EmbeddedResource Include="Properties\Resources.sk.resx" />
<EmbeddedResource Include="Properties\Resources.sv.resx" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
Expand Down
Loading

0 comments on commit 2119bc2

Please sign in to comment.