-
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
Polish localization (strings, formatter, tests) #140
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
168 changes: 168 additions & 0 deletions
168
src/Humanizer.Tests/Localisation/pl/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,168 @@ | ||
using Humanizer.Localisation; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.pl | ||
{ | ||
public class DateHumanizeTests : AmbientCulture | ||
{ | ||
public DateHumanizeTests() | ||
: base("pl") | ||
{ | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za sekundę")] | ||
[InlineData(2, "za 2 sekundy")] | ||
[InlineData(3, "za 3 sekundy")] | ||
[InlineData(4, "za 4 sekundy")] | ||
[InlineData(5, "za 5 sekund")] | ||
[InlineData(6, "za 6 sekund")] | ||
[InlineData(10, "za 10 sekund")] | ||
public void SecondsFromNow(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za minutę")] | ||
[InlineData(2, "za 2 minuty")] | ||
[InlineData(3, "za 3 minuty")] | ||
[InlineData(4, "za 4 minuty")] | ||
[InlineData(5, "za 5 minut")] | ||
[InlineData(6, "za 6 minut")] | ||
[InlineData(10, "za 10 minut")] | ||
public void MinutesFromNow(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za godzinę")] | ||
[InlineData(2, "za 2 godziny")] | ||
[InlineData(3, "za 3 godziny")] | ||
[InlineData(4, "za 4 godziny")] | ||
[InlineData(5, "za 5 godzin")] | ||
[InlineData(6, "za 6 godzin")] | ||
[InlineData(10, "za 10 godzin")] | ||
public void HoursFromNow(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "jutro")] | ||
[InlineData(2, "za 2 dni")] | ||
[InlineData(3, "za 3 dni")] | ||
[InlineData(4, "za 4 dni")] | ||
[InlineData(5, "za 5 dni")] | ||
[InlineData(6, "za 6 dni")] | ||
[InlineData(10, "za 10 dni")] | ||
public void DayFromNow(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za miesiąc")] | ||
[InlineData(2, "za 2 miesiące")] | ||
[InlineData(3, "za 3 miesiące")] | ||
[InlineData(4, "za 4 miesiące")] | ||
[InlineData(5, "za 5 miesięcy")] | ||
[InlineData(6, "za 6 miesięcy")] | ||
[InlineData(10, "za 10 miesięcy")] | ||
public void MonthsFromNow(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za rok")] | ||
[InlineData(2, "za 2 lata")] | ||
[InlineData(3, "za 3 lata")] | ||
[InlineData(4, "za 4 lata")] | ||
[InlineData(5, "za 5 lat")] | ||
[InlineData(6, "za 6 lat")] | ||
[InlineData(10, "za 10 lat")] | ||
public void YearsFromNow(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "przed sekundą")] | ||
[InlineData(2, "przed 2 sekundami")] | ||
[InlineData(3, "przed 3 sekundami")] | ||
[InlineData(4, "przed 4 sekundami")] | ||
[InlineData(5, "przed 5 sekundami")] | ||
[InlineData(6, "przed 6 sekundami")] | ||
[InlineData(10, "przed 10 sekundami")] | ||
public void SecondsAgo(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "przed minutą")] | ||
[InlineData(2, "przed 2 minutami")] | ||
[InlineData(3, "przed 3 minutami")] | ||
[InlineData(4, "przed 4 minutami")] | ||
[InlineData(5, "przed 5 minutami")] | ||
[InlineData(6, "przed 6 minutami")] | ||
[InlineData(10, "przed 10 minutami")] | ||
public void MinutesAgo(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "przed godziną")] | ||
[InlineData(2, "przed 2 godzinami")] | ||
[InlineData(3, "przed 3 godzinami")] | ||
[InlineData(4, "przed 4 godzinami")] | ||
[InlineData(5, "przed 5 godzinami")] | ||
[InlineData(6, "przed 6 godzinami")] | ||
[InlineData(10, "przed 10 godzinami")] | ||
public void HoursAgo(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "wczoraj")] | ||
[InlineData(2, "przed 2 dniami")] | ||
[InlineData(3, "przed 3 dniami")] | ||
[InlineData(4, "przed 4 dniami")] | ||
[InlineData(9, "przed 9 dniami")] | ||
[InlineData(10, "przed 10 dniami")] | ||
public void DayAgo(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "przed miesiącem")] | ||
[InlineData(2, "przed 2 miesiącami")] | ||
[InlineData(3, "przed 3 miesiącami")] | ||
[InlineData(4, "przed 4 miesiącami")] | ||
[InlineData(5, "przed 5 miesiącami")] | ||
[InlineData(6, "przed 6 miesiącami")] | ||
[InlineData(10, "przed 10 miesiącami")] | ||
public void MonthsAgo(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "przed rokiem")] | ||
[InlineData(2, "przed 2 laty")] | ||
[InlineData(3, "przed 3 laty")] | ||
[InlineData(4, "przed 4 laty")] | ||
[InlineData(5, "przed 5 laty")] | ||
[InlineData(6, "przed 6 laty")] | ||
[InlineData(10, "przed 10 laty")] | ||
public void YearsAgo(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); | ||
} | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
src/Humanizer.Tests/Localisation/pl/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,90 @@ | ||
using System; | ||
using Xunit; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.pl | ||
{ | ||
public class TimeSpanHumanizeTests : AmbientCulture | ||
{ | ||
public TimeSpanHumanizeTests() | ||
: base("pl") | ||
{ | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 milisekunda")] | ||
[InlineData(2, "2 milisekundy")] | ||
[InlineData(3, "3 milisekundy")] | ||
[InlineData(4, "4 milisekundy")] | ||
[InlineData(5, "5 milisekund")] | ||
[InlineData(6, "6 milisekund")] | ||
[InlineData(10, "10 milisekund")] | ||
public void Milliseconds(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromMilliseconds(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 sekunda")] | ||
[InlineData(2, "2 sekundy")] | ||
[InlineData(3, "3 sekundy")] | ||
[InlineData(4, "4 sekundy")] | ||
[InlineData(5, "5 sekund")] | ||
[InlineData(6, "6 sekund")] | ||
[InlineData(10, "10 sekund")] | ||
public void Seconds(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromSeconds(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 minuta")] | ||
[InlineData(2, "2 minuty")] | ||
[InlineData(3, "3 minuty")] | ||
[InlineData(4, "4 minuty")] | ||
[InlineData(5, "5 minut")] | ||
[InlineData(6, "6 minut")] | ||
[InlineData(10, "10 minut")] | ||
public void Minutes(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromMinutes(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 godzina")] | ||
[InlineData(2, "2 godziny")] | ||
[InlineData(3, "3 godziny")] | ||
[InlineData(4, "4 godziny")] | ||
[InlineData(5, "5 godzin")] | ||
[InlineData(6, "6 godzin")] | ||
[InlineData(10, "10 godzin")] | ||
public void Hours(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromHours(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 dzień")] | ||
[InlineData(2, "2 dni")] | ||
[InlineData(3, "3 dni")] | ||
[InlineData(4, "4 dni")] | ||
[InlineData(5, "5 dni")] | ||
[InlineData(6, "6 dni")] | ||
public void Days(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromDays(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 tydzień")] | ||
[InlineData(2, "2 tygodnie")] | ||
[InlineData(3, "3 tygodnie")] | ||
[InlineData(4, "4 tygodnie")] | ||
[InlineData(5, "5 tygodni")] | ||
[InlineData(6, "6 tygodni")] | ||
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
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
2 changes: 1 addition & 1 deletion
2
...izer/Localisation/CzechSlovakFormatter.cs → ...ocalisation/CzechSlovakPolishFormatter.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
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.
Thanks