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

Initial TimeSpan Arabic support #52

Merged
merged 2 commits into from
Jan 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
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
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>