Skip to content

Commit

Permalink
Merge pull request #612 from brencuks/dev
Browse files Browse the repository at this point in the history
Added Sweedish collection formatter
  • Loading branch information
hazzik authored Feb 13, 2017
2 parents f8772c7 + 96814cf commit 0954441
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Localisation\sr\DateHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\sr\NumberToWordsTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\sr\TimeSpanHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\sv\CollectionFormatterTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\sv\DateHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\sv\TimeSpanHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\tr\DateHumanizeTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Collections.Generic;
using Xunit;

namespace Humanizer.Tests.Localisation.sv
{
[UseCulture("sv-SE")]
public class CollectionFormatterTests
{
[Fact]
public void MoreThanTwoItems()
{
var collection = new List<int>(new[] {1, 2, 3});
var humanized = "1, 2 och 3";
Assert.Equal(humanized, collection.Humanize());
}

[Fact]
public void OneItem()
{
var collection = new List<int>(new[] {1});
var humanized = "1";
Assert.Equal(humanized, collection.Humanize());
}

[Fact]
public void TwoItems()
{
var collection = new List<int>(new[] {1, 2});
var humanized = "1 och 2";
Assert.Equal(humanized, collection.Humanize());
}
}
}
1 change: 1 addition & 0 deletions src/Humanizer/Configuration/CollectionFormatterRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public CollectionFormatterRegistry()
Register("ro", new DefaultCollectionFormatter("și"));
Register("nn", new DefaultCollectionFormatter("og"));
Register("nb", new DefaultCollectionFormatter("og"));
Register("sv", new DefaultCollectionFormatter("och"));
}
}
}

0 comments on commit 0954441

Please sign in to comment.