-
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
Swedish localization (strings, tests) #135
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
src/Humanizer.Tests/Localisation/sv/DateHumanizeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
using Humanizer.Localisation; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.sv | ||
{ | ||
public class DateHumanizeTests : AmbientCulture | ||
{ | ||
public DateHumanizeTests() | ||
: base("sv-SE") | ||
{ | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "om en sekund")] | ||
[InlineData(2, "om 2 sekunder")] | ||
public void SecondsFromNow(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "om en minut")] | ||
[InlineData(2, "om 2 minuter")] | ||
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. Got some weird spacing in here! |
||
public void MinutesFromNow(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "om en timme")] | ||
[InlineData(2, "om 2 timmar")] | ||
public void HoursFromNow(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "i morgon")] | ||
[InlineData(2, "om 2 dagar")] | ||
public void DayFromNow(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "om en månad")] | ||
[InlineData(2, "om 2 månader")] | ||
public void MonthsFromNow(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "om ett år")] | ||
[InlineData(2, "om 2 år")] | ||
public void YearsFromNow(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "en sekund sedan")] | ||
[InlineData(2, "för 2 sekunder sedan")] | ||
public void SecondsAgo(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "en minut sedan")] | ||
[InlineData(2, "för 2 minuter sedan")] | ||
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. And in here and a few other tests too! |
||
public void MinutesAgo(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "en timme sedan")] | ||
[InlineData(2, "för 2 timmar sedan")] | ||
public void HoursAgo(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "igår")] | ||
[InlineData(2, "för 2 dagar sedan")] | ||
public void DayAgo(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "en månad sedan")] | ||
[InlineData(2, "för 2 månader sedan")] | ||
public void MonthsAgo(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "ett år sedan")] | ||
[InlineData(2, "för 2 år sedan")] | ||
public void YearsAgo(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/Humanizer.Tests/Localisation/sv/TimeSpanHumanizeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
using Xunit; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.sv | ||
{ | ||
public class TimeSpanHumanizeTests : AmbientCulture | ||
{ | ||
public TimeSpanHumanizeTests() | ||
: base("sv-SE") | ||
{ | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 millisekund")] | ||
[InlineData(2, "2 millisekunder")] | ||
public void Milliseconds(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromMilliseconds(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 sekund")] | ||
[InlineData(2, "2 sekunder")] | ||
public void Seconds(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromSeconds(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 minut")] | ||
[InlineData(2, "2 minuter")] | ||
public void Minutes(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromMinutes(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 timma")] | ||
[InlineData(2, "2 timmar")] | ||
public void Hours(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromHours(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 dag")] | ||
[InlineData(2, "2 dagar")] | ||
public void Days(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromDays(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 vecka")] | ||
[InlineData(2, "2 veckor")] | ||
public void Weeks(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromDays(number*7).Humanize()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Yep. It's cool.