-
Notifications
You must be signed in to change notification settings - Fork 966
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
Japanese Translate #219
Japanese Translate #219
Changes from 1 commit
53f2888
9050cf9
c964bc3
13fc877
c71aabe
b1681ab
0d84f13
3c41096
27ac53d
0dece61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using Humanizer.Localisation; | ||
using Xunit; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.ja | ||
{ | ||
public class DateHumanizeTests : AmbientCulture | ||
{ | ||
public DateHumanizeTests() : base("ja") { } | ||
|
||
[Theory] | ||
[InlineData(1, "1 秒前")] | ||
[InlineData(2, "2 秒前")] | ||
public void SecondsAgo(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 秒後")] | ||
[InlineData(2, "2 秒後")] | ||
public void SecondsFromNow(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 分前")] | ||
[InlineData(2, "2 分前")] | ||
public void MinutesAgo(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 分後")] | ||
[InlineData(2, "2 分後")] | ||
public void MinutesFromNow(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 時間前")] | ||
[InlineData(2, "2 時間前")] | ||
public void HoursAgo(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 時間後")] | ||
[InlineData(2, "2 時間後")] | ||
public void HoursFromNow(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "昨日")] | ||
[InlineData(2, "2 日前")] | ||
public void DaysAgo(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "明日")] | ||
[InlineData(2, "2 日後")] | ||
public void DaysFromNow(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "先月")] | ||
[InlineData(2, "2 か月前")] | ||
public void MonthsAgo(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "来月")] | ||
[InlineData(2, "2 か月後")] | ||
public void MonthsFromNow(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "去年")] | ||
[InlineData(2, "2 年前")] | ||
public void YearsAgo(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "来年")] | ||
[InlineData(2, "2 年後")] | ||
public void YearsFromNow(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); | ||
} | ||
|
||
[Fact] | ||
public void Now() | ||
{ | ||
DateHumanize.Verify("今", 0, TimeUnit.Day, Tense.Past); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.ja | ||
{ | ||
public class TimeSpanHumanizeTests : AmbientCulture | ||
{ | ||
public TimeSpanHumanizeTests() : base("ja") { } | ||
|
||
[Fact] | ||
public void TwoWeeks() | ||
{ | ||
Assert.Equal("2 週間", TimeSpan.FromDays(14).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneWeek() | ||
{ | ||
Assert.Equal("1 週間", TimeSpan.FromDays(7).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void SixDays() | ||
{ | ||
Assert.Equal("6 日間", TimeSpan.FromDays(6).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoDays() | ||
{ | ||
Assert.Equal("2 日間", TimeSpan.FromDays(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneDay() | ||
{ | ||
Assert.Equal("1 日間", TimeSpan.FromDays(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoHours() | ||
{ | ||
Assert.Equal("2 時間", TimeSpan.FromHours(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneHour() | ||
{ | ||
Assert.Equal("1 時間", TimeSpan.FromHours(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoMinutes() | ||
{ | ||
Assert.Equal("2 分間", TimeSpan.FromMinutes(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneMinute() | ||
{ | ||
Assert.Equal("1 分間", TimeSpan.FromMinutes(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoSeconds() | ||
{ | ||
Assert.Equal("2 秒間", TimeSpan.FromSeconds(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneSecond() | ||
{ | ||
Assert.Equal("1 秒間", TimeSpan.FromSeconds(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoMilliseconds() | ||
{ | ||
Assert.Equal("2 ミリ秒間", TimeSpan.FromMilliseconds(2).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void OneMillisecond() | ||
{ | ||
Assert.Equal("1 ミリ秒間", TimeSpan.FromMilliseconds(1).Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void NoTime() | ||
{ | ||
// This one doesn't make a lot of sense but ... w/e | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what this says but please change it to say "0 seconds" if it makes sense: see #161 Please remove the comment too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MehdiK it says "no time" per Google Translate also, I like many others, found NoTime to be a bit confusing. @yhata based on a previous issue #161 we determined that 0 seconds is a better representation of no time in many languages. If it doesn't make sense to say 0 seconds (0秒間 ?) in Japanese, then another word or phrase would suffice. |
||
Assert.Equal("時間なし", TimeSpan.Zero.Humanize()); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change these to use Theory instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can see an example here