Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error in nb-NO resource file, added resource strings and added tests #137

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed ett/et gramatical error in nb-NO resource file
Added some tests for timespan in nb-NO locale. Fixed ett/et errors in
the resource file
  • Loading branch information
henriksen committed Apr 9, 2014
commit ce931aa9125ba5dc191f79ce5244c2f149e7fd12
1 change: 1 addition & 0 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<Compile Include="DateHumanize.cs" />
<Compile Include="Localisation\cs\DateHumanizeTests.cs" />
<Compile Include="Localisation\cs\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\nb-NO\TimeSpanHumanizeTests.cs" />
<Compile Include="Localisation\sk\DateHumanizeTests.cs" />
<Compile Include="Localisation\ar\DateHumanizeTests.cs" />
<Compile Include="Localisation\ar\NumberToWordsTests.cs" />
Expand Down
59 changes: 59 additions & 0 deletions src/Humanizer.Tests/Localisation/nb-NO/TimeSpanHumanizeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.nbNO
{
public class TimeSpanHumanizeTests : AmbientCulture
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for translating the TimeSpan resources and for the tests. TimeSpan was added much later to the lib and so it's missing translation for a lot of languages.

{
public TimeSpanHumanizeTests() : base("nb-NO") { }

[Theory]
[InlineData(7, "en uke")]
public void Weeks(int days, string expected)
{
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize());
}

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

[Theory]
[InlineData(1, "en time")]
public void Hours(int hours, string expected)
{
Assert.Equal(expected, TimeSpan.FromHours(hours).Humanize());
}

[Theory]
[InlineData(1, "ett minutt")]
public void Minutes(int minutes, string expected)
{
Assert.Equal(expected, TimeSpan.FromMinutes(minutes).Humanize());
}

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

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

[Fact]
public void NoTime()
{
Assert.Equal("ingen tid", TimeSpan.Zero.Humanize());
}
}
}
6 changes: 3 additions & 3 deletions src/Humanizer/Properties/Resources.nb-NO.resx
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@
<value>en time</value>
</data>
<data name="TimeSpanHumanize_SingleMillisecond" xml:space="preserve">
<value>et millisekund</value>
<value>ett millisekund</value>
</data>
<data name="TimeSpanHumanize_SingleMinute" xml:space="preserve">
<value>et minutt</value>
<value>ett minutt</value>
</data>
<data name="TimeSpanHumanize_SingleSecond" xml:space="preserve">
<value>et sekund</value>
<value>ett sekund</value>
</data>
<data name="TimeSpanHumanize_Zero" xml:space="preserve">
<value>ingen tid</value>
Expand Down