-
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
added Czech localization (strings, formatter, tests) #130
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
13a4ec9
* tests for Czech
igorkulman 1111fa1
* Czech tests reviewed and fixed
igorkulman 973cea0
+ Czech datetime and timespan localization with passing tests
igorkulman 0f1e5e7
* designer files removed
igorkulman cd20304
Merge branch 'master' of https://github.com/MehdiK/Humanizer
igorkulman 52f8d31
* Slovak and Czech formatters merged
igorkulman d81d7dd
* typos fixed
igorkulman b96d2f3
* redundant spaces removed
igorkulman 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
168 changes: 168 additions & 0 deletions
168
src/Humanizer.Tests/Localisation/cs/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 System; | ||
using Xunit; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.cs | ||
{ | ||
public class DateTimeHumanizeTests : AmbientCulture | ||
{ | ||
public DateTimeHumanizeTests() | ||
: base("cs-CZ") | ||
{ | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za sekundu")] | ||
[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 number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddSeconds(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za minutu")] | ||
[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 number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddMinutes(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za hodinu")] | ||
[InlineData(2, "za 2 hodiny")] | ||
[InlineData(3, "za 3 hodiny")] | ||
[InlineData(4, "za 4 hodiny")] | ||
[InlineData(5, "za 5 hodin")] | ||
[InlineData(6, "za 6 hodin")] | ||
[InlineData(10, "za 10 hodin")] | ||
public void HoursFromNow(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddHours(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "zítra")] | ||
[InlineData(2, "za 2 dny")] | ||
[InlineData(3, "za 3 dny")] | ||
[InlineData(4, "za 4 dny")] | ||
[InlineData(9, "za 9 dnů")] | ||
[InlineData(10, "za 10 dnů")] | ||
public void DayFromNow(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddDays(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za měsíc")] | ||
[InlineData(2, "za 2 měsíce")] | ||
[InlineData(3, "za 3 měsíce")] | ||
[InlineData(4, "za 4 měsíce")] | ||
[InlineData(5, "za 5 měsíců")] | ||
[InlineData(6, "za 6 měsíců")] | ||
[InlineData(10, "za 10 měsíců")] | ||
public void MonthsFromNow(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddMonths(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "za rok")] | ||
[InlineData(2, "za 2 roky")] | ||
[InlineData(3, "za 3 roky")] | ||
[InlineData(4, "za 4 roky")] | ||
[InlineData(5, "za 5 let")] | ||
[InlineData(6, "za 6 let")] | ||
[InlineData(10, "za 10 let")] | ||
public void YearsFromNow(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddYears(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "před sekundou")] | ||
[InlineData(2, "před 2 sekundami")] | ||
[InlineData(3, "před 3 sekundami")] | ||
[InlineData(4, "před 4 sekundami")] | ||
[InlineData(5, "před 5 sekundami")] | ||
[InlineData(6, "před 6 sekundami")] | ||
[InlineData(10, "před 10 sekundami")] | ||
public void SecondsAgo(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddSeconds(-1 * number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "před minutou")] | ||
[InlineData(2, "před 2 minutami")] | ||
[InlineData(3, "před 3 minutami")] | ||
[InlineData(4, "před 4 minutami")] | ||
[InlineData(5, "před 5 minutami")] | ||
[InlineData(6, "před 6 minutami")] | ||
[InlineData(10, "před 10 minutami")] | ||
public void MinutesAgo(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddMinutes(-1 * number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "před hodinou")] | ||
[InlineData(2, "před 2 hodinami")] | ||
[InlineData(3, "před 3 hodinami")] | ||
[InlineData(4, "před 4 hodinami")] | ||
[InlineData(5, "před 5 hodinami")] | ||
[InlineData(6, "před 6 hodinami")] | ||
[InlineData(10, "před 10 hodinami")] | ||
public void HoursAgo(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddHours(-1 * number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "včera")] | ||
[InlineData(2, "před 2 dny")] | ||
[InlineData(3, "před 3 dny")] | ||
[InlineData(4, "před 4 dny")] | ||
[InlineData(9, "před 9 dny")] | ||
[InlineData(10, "před 10 dny")] | ||
public void DayAgo(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddDays(-1 * number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "před měsícem")] | ||
[InlineData(2, "před 2 měsíci")] | ||
[InlineData(3, "před 3 měsíci")] | ||
[InlineData(4, "před 4 měsíci")] | ||
[InlineData(5, "před 5 měsíci")] | ||
[InlineData(6, "před 6 měsíci")] | ||
[InlineData(10, "před 10 měsíci")] | ||
public void MonthsAgo(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddMonths(-1 * number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "před rokem")] | ||
[InlineData(2, "před 2 lety")] | ||
[InlineData(3, "před 3 lety")] | ||
[InlineData(4, "před 4 lety")] | ||
[InlineData(5, "před 5 lety")] | ||
[InlineData(6, "před 6 lety")] | ||
[InlineData(10, "před 10 lety")] | ||
public void YearsAgo(int number, string expected) | ||
{ | ||
Assert.Equal(expected, DateTime.UtcNow.AddYears(-1 * number).Humanize()); | ||
} | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
src/Humanizer.Tests/Localisation/cs/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,92 @@ | ||
using System; | ||
using Xunit; | ||
using Xunit.Extensions; | ||
|
||
namespace Humanizer.Tests.Localisation.cs | ||
{ | ||
public class TimeSpanHumanizeTests : AmbientCulture | ||
{ | ||
public TimeSpanHumanizeTests() | ||
: base("cs-CZ") | ||
{ | ||
} | ||
|
||
[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 hodina")] | ||
[InlineData(2, "2 hodiny")] | ||
[InlineData(3, "3 hodiny")] | ||
[InlineData(4, "4 hodiny")] | ||
[InlineData(5, "5 hodin")] | ||
[InlineData(6, "6 hodin")] | ||
[InlineData(10, "10 hodin")] | ||
public void Hours(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromHours(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 den")] | ||
[InlineData(2, "2 dny")] | ||
[InlineData(3, "3 dny")] | ||
[InlineData(4, "4 dny")] | ||
[InlineData(5, "5 dnů")] | ||
[InlineData(6, "6 dnů")] | ||
public void Days(int number, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromDays(number).Humanize()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "1 týden")] | ||
[InlineData(2, "2 týdny")] | ||
[InlineData(3, "3 týdny")] | ||
[InlineData(4, "4 týdny")] | ||
[InlineData(5, "5 týdnů")] | ||
[InlineData(6, "6 týdnů")] | ||
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
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 |
---|---|---|
|
@@ -70,7 +70,7 @@ | |
<Compile Include="CasingExtensions.cs" /> | ||
<Compile Include="Configuration\Configurator.cs" /> | ||
<Compile Include="DateHumanizeExtensions.cs" /> | ||
<Compile Include="Localisation\SlovakFormatter.cs" /> | ||
<Compile Include="Localisation\CzechSlovakFormatter.cs" /> | ||
<Compile Include="Localisation\TimeUnitTense.cs" /> | ||
<Compile Include="TimeSpanHumanizeExtensions.cs" /> | ||
<Compile Include="FluentDate\In.SomeTimeFrom.cs"> | ||
|
@@ -145,6 +145,7 @@ | |
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Properties\Resources.cs.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.de.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.fa.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.nb-NO.resx" /> | ||
|
@@ -154,17 +155,13 @@ | |
<EmbeddedResource Include="Properties\Resources.es.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.el.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.ru.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.ar.resx"> | ||
<SubType>Designer</SubType> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="Properties\Resources.ar.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.fr.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.nl.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.ro.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.pt-BR.resx" /> | ||
<EmbeddedResource Include="Properties\Resources.sk.resx"> | ||
<LastGenOutput>Resources.sk.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="Properties\Resources.sk.resx" /> | ||
</ItemGroup> | ||
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. Thanks for removing these |
||
<ItemGroup> | ||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> | ||
|
2 changes: 1 addition & 1 deletion
2
...Humanizer/Localisation/SlovakFormatter.cs → ...izer/Localisation/CzechSlovakFormatter.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.
Please remove the redundant spaces.