-
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
Danish translation #144
Closed
Closed
Danish translation #144
Changes from 2 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
139 changes: 139 additions & 0 deletions
139
src/Humanizer.Tests/Localisation/da/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,139 @@ | ||
using Humanizer.Localisation; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.da | ||
{ | ||
public class DateHumanizeTests : AmbientCulture | ||
{ | ||
public DateHumanizeTests() | ||
: base("da") | ||
{ | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 dage siden")] | ||
[InlineData(-3, "3 dage siden")] | ||
[InlineData(-2, "2 dage siden")] | ||
[InlineData(-1, "i går")] | ||
public void DaysAgo(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "i morgen")] | ||
[InlineData(10, "10 dage fra nu")] | ||
[InlineData(28, "28 dage fra nu")] | ||
[InlineData(32, "en måned fra nu")] | ||
public void DaysFromNow(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "et sekund fra nu")] | ||
[InlineData(10, "10 sekunder fra nu")] | ||
[InlineData(59, "59 sekunder fra nu")] | ||
[InlineData(60, "et minut fra nu")] | ||
public void SecondsFromNow(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 timer siden")] | ||
[InlineData(-3, "3 timer siden")] | ||
[InlineData(-2, "2 timer siden")] | ||
[InlineData(-1, "en time siden")] | ||
public void HoursAgo(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "en time fra nu")] | ||
[InlineData(10, "10 timer fra nu")] | ||
[InlineData(23, "23 timer fra nu")] | ||
[InlineData(24, "i morgen")] | ||
public void HoursFromNow(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 minutter siden")] | ||
[InlineData(-3, "3 minutter siden")] | ||
[InlineData(-2, "2 minutter siden")] | ||
[InlineData(-1, "et minut siden")] | ||
public void MinutesAgo(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "et minut fra nu")] | ||
[InlineData(10, "10 minutter fra nu")] | ||
[InlineData(44, "44 minutter fra nu")] | ||
[InlineData(45, "en time fra nu")] | ||
[InlineData(119, "en time fra nu")] | ||
[InlineData(120, "2 timer fra nu")] | ||
public void MinutesFromNow(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); | ||
} | ||
[Theory] | ||
[InlineData(-10, "10 måneder siden")] | ||
[InlineData(-3, "3 måneder siden")] | ||
[InlineData(-2, "2 måneder siden")] | ||
[InlineData(-1, "en måned siden")] | ||
public void MonthsAgo(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "en måned fra nu")] | ||
[InlineData(10, "10 måneder fra nu")] | ||
[InlineData(11, "11 måneder fra nu")] | ||
[InlineData(12, "et år fra nu")] | ||
public void MonthsFromNow(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 sekunder siden")] | ||
[InlineData(-3, "3 sekunder siden")] | ||
[InlineData(-2, "2 sekunder siden")] | ||
[InlineData(-1, "et sekund siden")] | ||
public void SecondsAgo(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, "10 år siden")] | ||
[InlineData(-3, "3 år siden")] | ||
[InlineData(-2, "2 år siden")] | ||
[InlineData(-1, "et år siden")] | ||
public void YearsAgo(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "et år fra nu")] | ||
[InlineData(2, "2 år fra nu")] | ||
public void YearsFromNow(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, "nu")] | ||
public void Now(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); | ||
} | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
src/Humanizer.Tests/Localisation/da/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,101 @@ | ||
using System; | ||
using Xunit; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.da | ||
{ | ||
public class TimeSpanHumanizeTests : AmbientCulture | ||
{ | ||
public TimeSpanHumanizeTests() : base("da") { } | ||
|
||
[Theory] | ||
[InlineData(7, "en uge")] | ||
[InlineData(14, "2 uger")] | ||
public void Weeks(int days, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "en dag")] | ||
[InlineData(2, "2 dage")] | ||
public void Days(int days, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "en time")] | ||
[InlineData(2, "2 timer")] | ||
public void Hours(int hours, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromHours(hours).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "et minut")] | ||
[InlineData(2, "2 minutter")] | ||
public void Minutes(int minutes, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromMinutes(minutes).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "et sekund")] | ||
[InlineData(2, "2 sekunder")] | ||
public void Seconds(int seconds, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromSeconds(seconds).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "et millisekund")] | ||
[InlineData(2, "2 millisekunder")] | ||
public void Milliseconds(int milliseconds, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromMilliseconds(milliseconds).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, 3, "ingen tid")] | ||
[InlineData(0, 2, "ingen tid")] | ||
[InlineData(10, 2, "10 millisekunder")] | ||
[InlineData(1400, 2, "1 sekund, 400 millisekunder")] | ||
[InlineData(2500, 2, "2 sekunder, 500 millisekunder")] | ||
[InlineData(120000, 2, "2 minutter")] | ||
[InlineData(62000, 2, "1 minute, 2 sekunder")] | ||
[InlineData(62020, 2, "1 minute, 2 sekunder")] | ||
[InlineData(62020, 3, "1 minute, 2 sekunder, 20 millisekunder")] | ||
[InlineData(3600020, 4, "1 time, 20 millisekunder")] | ||
[InlineData(3600020, 3, "1 time, 20 millisekunder")] | ||
[InlineData(3600020, 2, "1 time, 20 millisekunder")] | ||
[InlineData(3600020, 1, "1 time")] | ||
[InlineData(3603001, 2, "1 time, 3 sekunder")] | ||
[InlineData(3603001, 3, "1 time, 3 sekunder, 1 millisekund")] | ||
[InlineData(86400000, 3, "1 dag")] | ||
[InlineData(86400000, 2, "1 dag")] | ||
[InlineData(86400000, 1, "1 dag")] | ||
[InlineData(86401000, 1, "1 dag")] | ||
[InlineData(86401000, 2, "1 dag, 1 sekund")] | ||
[InlineData(86401200, 2, "1 dag, 1 sekund")] | ||
[InlineData(86401200, 3, "1 dag, 1 sekund, 200 millisekunder")] | ||
[InlineData(1296000000, 1, "2 weeks")] | ||
[InlineData(1296000000, 2, "2 weeks, 1 dag")] | ||
[InlineData(1299600000, 2, "2 weeks, 1 dag")] | ||
[InlineData(1299600000, 3, "2 weeks, 1 dag, 1 time")] | ||
[InlineData(1299630020, 3, "2 weeks, 1 dag, 1 time")] | ||
[InlineData(1299630020, 4, "2 weeks, 1 dag, 1 time, 30 sekunder")] | ||
[InlineData(1299630020, 5, "2 weeks, 1 dag, 1 time, 30 sekunder, 20 millisekunder")] | ||
public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) | ||
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. This isn't necessary here. In the main implementation I had to make sure that precisions work but once that's proven and you test your translations, the rest is just the implementation stitching the two together. So please remove this. Thanks. |
||
{ | ||
var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Fact] | ||
public void NoTime() | ||
{ | ||
Assert.Equal("ingen tid", TimeSpan.Zero.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.
Please remove the redundant spaces from here.