Skip to content

Commit

Permalink
Merge pull request #52 from harouny/master
Browse files Browse the repository at this point in the history
Initial TimeSpan Arabic support
  • Loading branch information
MehdiK committed Jan 6, 2014
2 parents ddabab5 + 8b6a26c commit ffc27ea
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CasingTests.cs" />
<Compile Include="Localisation\ar\TimeSpanTests.cs" />
<Compile Include="Localisation\DateHumanizeTests.nb-NO.cs" />
<Compile Include="Localisation\es\DateHumanizeTests.cs" />
<Compile Include="Localisation\es\TimeSpanTests.cs" />
Expand Down
52 changes: 52 additions & 0 deletions src/Humanizer.Tests/Localisation/ar/TimeSpanTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using Xunit;

namespace Humanizer.Tests.Localisation.ar
{
public class TimeSpanHumanizeExtensionsTests : AmbientCulture
{
public TimeSpanHumanizeExtensionsTests() : base("ar") { }

[Fact]
public void OneWeek()
{
Assert.Equal("أسبوع واحد", TimeSpan.FromDays(7).Humanize());
}

[Fact]
public void OneDay()
{
Assert.Equal("يوم واحد", TimeSpan.FromDays(1).Humanize());
}

[Fact]
public void OneHour()
{
Assert.Equal("ساعة واحدة", TimeSpan.FromHours(1).Humanize());
}

[Fact]
public void OneMinute()
{
Assert.Equal("دقيقة واحدة", TimeSpan.FromMinutes(1).Humanize());
}

[Fact]
public void OneSecond()
{
Assert.Equal("ثانية واحدة", TimeSpan.FromSeconds(1).Humanize());
}

[Fact]
public void OneMillisecond()
{
Assert.Equal("جزء من الثانية", TimeSpan.FromMilliseconds(1).Humanize());
}

[Fact]
public void NoTime()
{
Assert.Equal("حالاً", TimeSpan.Zero.Humanize());
}
}
}
28 changes: 28 additions & 0 deletions src/Humanizer/Properties/Resources.ar.resx
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,32 @@
<value>منذ {0} سنوات</value>
<comment>{0} years ago</comment>
</data>
<data name="TimeSpanHumanize_SingleDay" xml:space="preserve">
<value>يوم واحد</value>
<comment>single day</comment>
</data>
<data name="TimeSpanHumanize_SingleHour" xml:space="preserve">
<value>ساعة واحدة</value>
<comment>single hour</comment>
</data>
<data name="TimeSpanHumanize_SingleMillisecond" xml:space="preserve">
<value>جزء من الثانية</value>
<comment>single millisecond</comment>
</data>
<data name="TimeSpanHumanize_SingleMinute" xml:space="preserve">
<value>دقيقة واحدة</value>
<comment>single minute</comment>
</data>
<data name="TimeSpanHumanize_SingleSecond" xml:space="preserve">
<value>ثانية واحدة</value>
<comment>single second</comment>
</data>
<data name="TimeSpanHumanize_SingleWeek" xml:space="preserve">
<value>أسبوع واحد</value>
<comment>single week</comment>
</data>
<data name="TimeSpanHumanize_Zero" xml:space="preserve">
<value>حالاً</value>
<comment>no time</comment>
</data>
</root>

0 comments on commit ffc27ea

Please sign in to comment.