-
Notifications
You must be signed in to change notification settings - Fork 966
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1116 from Kristinn-Stefansson/feature/IcelandicLa…
…nguageSupport Feature/icelandic language support
- Loading branch information
Showing
23 changed files
with
1,910 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package> | ||
<metadata minClientVersion="2.12"> | ||
<id>Humanizer.Core.is</id> | ||
<version>$version$</version> | ||
<title>Humanizer Locale (is)</title> | ||
<authors>Mehdi Khalili, Claire Novotny</authors> | ||
<projectUrl>https://github.com/Humanizr/Humanizer</projectUrl> | ||
<icon>logo.png</icon> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>Humanizer Locale Icelandic (is)</description> | ||
<copyright>Copyright (c) .NET Foundation and Contributors</copyright> | ||
<license type="expression">MIT</license> | ||
<repository type="$RepositoryType$" url="$RepositoryUrl$" commit="$RepositoryCommit$" /> | ||
<language>is</language> | ||
<dependencies> | ||
<dependency id="Humanizer.Core" version="[$version$]" /> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="Humanizer\bin\Release\netstandard1.0\is\*.*" target="lib\netstandard1.0\is" /> | ||
<file src="Humanizer\bin\Release\netstandard2.0\is\*.*" target="lib\netstandard2.0\is" /> | ||
<file src="Humanizer\bin\Release\net6.0\is\*.*" target="lib\net6.0\is" /> | ||
<file src="..\logo.png" target="logo.png" /> | ||
</files> | ||
</package> |
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
77 changes: 77 additions & 0 deletions
77
src/Humanizer.Tests.Shared/Localisation/is/Bytes/ByteSizeExtensionsTests.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,77 @@ | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.@is.Bytes | ||
{ | ||
[UseCulture("is")] | ||
public class ByteSizeExtensionsTests | ||
{ | ||
[Theory] | ||
[InlineData(2, null, "2 TB")] | ||
[InlineData(2, "GB", "2048 GB")] | ||
[InlineData(2.123, "#.#", "2,1 TB")] | ||
public void HumanizesTerabytes(double input, string format, string expectedValue) | ||
{ | ||
Assert.Equal(expectedValue, input.Terabytes().Humanize(format)); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, null, "0 b")] | ||
[InlineData(0, "GB", "0 GB")] | ||
[InlineData(2, null, "2 GB")] | ||
[InlineData(2, "MB", "2048 MB")] | ||
[InlineData(2.123, "#.##", "2,12 GB")] | ||
public void HumanizesGigabytes(double input, string format, string expectedValue) | ||
{ | ||
Assert.Equal(expectedValue, input.Gigabytes().Humanize(format)); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, null, "0 b")] | ||
[InlineData(0, "MB", "0 MB")] | ||
[InlineData(2, null, "2 MB")] | ||
[InlineData(2, "KB", "2048 kB")] | ||
[InlineData(2.123, "#", "2 MB")] | ||
public void HumanizesMegabytes(double input, string format, string expectedValue) | ||
{ | ||
Assert.Equal(expectedValue, input.Megabytes().Humanize(format)); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, null, "0 b")] | ||
[InlineData(0, "KB", "0 kB")] | ||
[InlineData(2, null, "2 kB")] | ||
[InlineData(2, "B", "2048 B")] | ||
[InlineData(2.123, "#.####", "2,123 kB")] | ||
public void HumanizesKilobytes(double input, string format, string expectedValue) | ||
{ | ||
Assert.Equal(expectedValue, input.Kilobytes().Humanize(format)); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, null, "0 b")] | ||
[InlineData(0, "#.##", "0 b")] | ||
[InlineData(0, "#.## B", "0 B")] | ||
[InlineData(0, "B", "0 B")] | ||
[InlineData(2, null, "2 B")] | ||
[InlineData(2000, "KB", "1,95 kB")] | ||
[InlineData(2123, "#.##", "2,07 kB")] | ||
[InlineData(10000000, "KB", "9765,63 kB")] | ||
[InlineData(10000000, "#,##0 KB", "9.766 kB")] | ||
[InlineData(10000000, "#,##0.# KB", "9.765,6 kB")] | ||
public void HumanizesBytes(double input, string format, string expectedValue) | ||
{ | ||
Assert.Equal(expectedValue, input.Bytes().Humanize(format)); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, null, "0 b")] | ||
[InlineData(0, "b", "0 b")] | ||
[InlineData(2, null, "2 b")] | ||
[InlineData(12, "B", "1,5 B")] | ||
[InlineData(10000, "#.# KB", "1,2 kB")] | ||
public void HumanizesBits(long input, string format, string expectedValue) | ||
{ | ||
Assert.Equal(expectedValue, input.Bits().Humanize(format)); | ||
} | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
src/Humanizer.Tests.Shared/Localisation/is/Bytes/ToFullWordsTests.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 Humanizer.Bytes; | ||
|
||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.@is.Bytes | ||
{ | ||
[UseCulture("is")] | ||
public class ToFullWordsTests | ||
{ | ||
[Fact] | ||
public void ReturnsSingularBit() | ||
{ | ||
Assert.Equal("1 biti", ByteSize.FromBits(1).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsPluralBits() | ||
{ | ||
Assert.Equal("2 biti", ByteSize.FromBits(2).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsSingularByte() | ||
{ | ||
Assert.Equal("1 bæti", ByteSize.FromBytes(1).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsPluralBytes() | ||
{ | ||
Assert.Equal("10 bæti", ByteSize.FromBytes(10).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsSingularKiloByte() | ||
{ | ||
Assert.Equal("1 kílóbæti", ByteSize.FromKilobytes(1).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsPluralKilobytes() | ||
{ | ||
Assert.Equal("10 kílóbæti", ByteSize.FromKilobytes(10).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsSingularMegabyte() | ||
{ | ||
Assert.Equal("1 megabæti", ByteSize.FromMegabytes(1).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsPluralMegabytes() | ||
{ | ||
Assert.Equal("10 megabæti", ByteSize.FromMegabytes(10).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsSingularGigabyte() | ||
{ | ||
Assert.Equal("1 gígabæti", ByteSize.FromGigabytes(1).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsPluralGigabytes() | ||
{ | ||
Assert.Equal("10 gígabæti", ByteSize.FromGigabytes(10).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsSingularTerabyte() | ||
{ | ||
Assert.Equal("1 terabæti", ByteSize.FromTerabytes(1).ToFullWords()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsPluralTerabytes() | ||
{ | ||
Assert.Equal("10 terabæti", ByteSize.FromTerabytes(10).ToFullWords()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(229376, "B", "229376 bæti")] | ||
[InlineData(229376, "# KB", "224 kílóbæti")] | ||
public void ToFullWordsFormatted(double input, string format, string expectedValue) | ||
{ | ||
Assert.Equal(expectedValue, ByteSize.FromBytes(input).ToFullWords(format)); | ||
} | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
src/Humanizer.Tests.Shared/Localisation/is/Bytes/ToStringTests.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,88 @@ | ||
using Humanizer.Bytes; | ||
|
||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.@is.Bytes | ||
{ | ||
[UseCulture("is")] | ||
public class ToStringTests | ||
{ | ||
[Fact] | ||
public void ReturnsLargestMetricSuffix() | ||
{ | ||
Assert.Equal("10,5 kB", ByteSize.FromKilobytes(10.5).ToString()); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsDefaultNumberFormat() | ||
{ | ||
Assert.Equal("10,5 kB", ByteSize.FromKilobytes(10.5).ToString("KB")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsProvidedNumberFormat() | ||
{ | ||
Assert.Equal("10,1234 kB", ByteSize.FromKilobytes(10.1234).ToString("#.#### KB")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsBits() | ||
{ | ||
Assert.Equal("10 b", ByteSize.FromBits(10).ToString("##.#### b")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsBytes() | ||
{ | ||
Assert.Equal("10 B", ByteSize.FromBytes(10).ToString("##.#### B")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsKilobytes() | ||
{ | ||
Assert.Equal("10 kB", ByteSize.FromKilobytes(10).ToString("##.#### KB")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsMegabytes() | ||
{ | ||
Assert.Equal("10 MB", ByteSize.FromMegabytes(10).ToString("##.#### MB")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsGigabytes() | ||
{ | ||
Assert.Equal("10 GB", ByteSize.FromGigabytes(10).ToString("##.#### GB")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsTerabytes() | ||
{ | ||
Assert.Equal("10 TB", ByteSize.FromTerabytes(10).ToString("##.#### TB")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsSelectedFormat() | ||
{ | ||
Assert.Equal("10,0 TB", ByteSize.FromTerabytes(10).ToString("0.0 TB")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsLargestMetricPrefixLargerThanZero() | ||
{ | ||
Assert.Equal("512 kB", ByteSize.FromMegabytes(.5).ToString("#.#")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsLargestMetricPrefixLargerThanZeroForNegativeValues() | ||
{ | ||
Assert.Equal("-512 kB", ByteSize.FromMegabytes(-.5).ToString("#.#")); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsBytesViaGeneralFormat() | ||
{ | ||
Assert.Equal("10 B", $"{ByteSize.FromBytes(10)}"); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Humanizer.Tests.Shared/Localisation/is/CollectionFormatterTests.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,34 @@ | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.@is | ||
{ | ||
[UseCulture("is")] | ||
public class CollectionFormatterTests | ||
{ | ||
|
||
[Fact] | ||
public void OneItem() | ||
{ | ||
var collection = new List<int>(new[] { 1 }); | ||
var humanized = "1"; | ||
Assert.Equal(humanized, collection.Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void TwoItems() | ||
{ | ||
var collection = new List<int>(new[] { 1, 2 }); | ||
var humanized = "1 og 2"; | ||
Assert.Equal(humanized, collection.Humanize()); | ||
} | ||
|
||
[Fact] | ||
public void MoreThanTwoItems() | ||
{ | ||
var collection = new List<int>(new[] { 1, 2, 3 }); | ||
var humanized = "1, 2 og 3"; | ||
Assert.Equal(humanized, collection.Humanize()); | ||
} | ||
} | ||
} |
Oops, something went wrong.