-
Notifications
You must be signed in to change notification settings - Fork 965
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 #942 from tivole/master
Add Azerbaijani language support
- Loading branch information
Showing
13 changed files
with
694 additions
and
3 deletions.
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,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package> | ||
<metadata minClientVersion="2.12"> | ||
<id>Humanizer.Core.az</id> | ||
<version>$version$</version> | ||
<title>Humanizer Locale (az)</title> | ||
<authors>Mehdi Khalili, Claire Novotny</authors> | ||
<projectUrl>https://github.com/Humanizr/Humanizer</projectUrl> | ||
<icon>logo.png</icon> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>Humanizer Locale Azerbaijani (az)</description> | ||
<copyright>Copyright (c) .NET Foundation and Contributors</copyright> | ||
<license type="expression">MIT</license> | ||
<repository type="$RepositoryType$" url="$RepositoryUrl$" commit="$RepositoryCommit$" /> | ||
<language>az</language> | ||
<dependencies> | ||
<dependency id="Humanizer.Core" version="[$version$]" /> | ||
</dependencies> | ||
</metadata> | ||
<files> | ||
<file src="Humanizer\bin\Release\netstandard1.0\az\*.*" target="lib\netstandard1.0\az" /> | ||
<file src="Humanizer\bin\Release\netstandard2.0\az\*.*" target="lib\netstandard2.0\az" /> | ||
<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
113 changes: 113 additions & 0 deletions
113
src/Humanizer.Tests.Shared/Localisation/az/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,113 @@ | ||
using Humanizer.Localisation; | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.az | ||
{ | ||
[UseCulture("az")] | ||
public class DateHumanizeTests | ||
{ | ||
|
||
[Theory] | ||
[InlineData(1, "bir saniyə əvvəl")] | ||
[InlineData(10, "10 saniyə əvvəl")] | ||
public void SecondsAgo(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir saniyə sonra")] | ||
[InlineData(10, "10 saniyə sonra")] | ||
public void SecondsFromNow(int seconds, string expected) | ||
{ | ||
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir dəqiqə əvvəl")] | ||
[InlineData(10, "10 dəqiqə əvvəl")] | ||
[InlineData(60, "bir saat əvvəl")] | ||
public void MinutesAgo(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir dəqiqə sonra")] | ||
[InlineData(10, "10 dəqiqə sonra")] | ||
public void MinutesFromNow(int minutes, string expected) | ||
{ | ||
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir saat əvvəl")] | ||
[InlineData(10, "10 saat əvvəl")] | ||
public void HoursAgo(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir saat sonra")] | ||
[InlineData(10, "10 saat sonra")] | ||
public void HoursFromNow(int hours, string expected) | ||
{ | ||
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "dünən")] | ||
[InlineData(10, "10 gün əvvəl")] | ||
public void DaysAgo(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "sabah")] | ||
[InlineData(10, "10 gün sonra")] | ||
public void DaysFromNow(int days, string expected) | ||
{ | ||
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir ay əvvəl")] | ||
[InlineData(10, "10 ay əvvəl")] | ||
public void MonthsAgo(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir ay sonra")] | ||
[InlineData(10, "10 ay sonra")] | ||
public void MonthsFromNow(int months, string expected) | ||
{ | ||
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir il əvvəl")] | ||
[InlineData(2, "2 il əvvəl")] | ||
public void YearsAgo(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); | ||
} | ||
|
||
[Theory] | ||
[InlineData(1, "bir il sonra")] | ||
[InlineData(2, "2 il sonra")] | ||
public void YearsFromNow(int years, string expected) | ||
{ | ||
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); | ||
} | ||
|
||
[Fact] | ||
public void Now() | ||
{ | ||
DateHumanize.Verify("indi", 0, TimeUnit.Year, Tense.Future); | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/Humanizer.Tests.Shared/Localisation/az/NumberToWordsTests.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,73 @@ | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.az | ||
{ | ||
[UseCulture("az")] | ||
public class NumberToWordsTests | ||
{ | ||
[Theory] | ||
[InlineData("sıfır", 0)] | ||
[InlineData("bir", 1)] | ||
[InlineData("iki", 2)] | ||
[InlineData("on", 10)] | ||
[InlineData("yüz on iki", 112)] | ||
[InlineData("min dörd yüz qırx", 1440)] | ||
[InlineData("yirmi iki", 22)] | ||
[InlineData("on bir", 11)] | ||
[InlineData("üç min beş yüz bir", 3501)] | ||
[InlineData("bir milyon bir", 1000001)] | ||
[InlineData("mənfi bir milyon üç yüz qırx altı min yeddi yüz on bir", -1346711)] | ||
public void ToWords(string expected, int number) | ||
{ | ||
Assert.Equal(expected, number.ToWords()); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, "sıfırıncı")] | ||
[InlineData(1, "birinci")] | ||
[InlineData(2, "ikinci")] | ||
[InlineData(3, "üçüncü")] | ||
[InlineData(4, "dördüncü")] | ||
[InlineData(5, "beşinci")] | ||
[InlineData(6, "altıncı")] | ||
[InlineData(7, "yeddinci")] | ||
[InlineData(8, "səkkizinci")] | ||
[InlineData(9, "doqquzuncu")] | ||
[InlineData(10, "onuncu")] | ||
[InlineData(11, "on birinci")] | ||
[InlineData(12, "on ikinci")] | ||
[InlineData(13, "on üçüncü")] | ||
[InlineData(14, "on dördüncü")] | ||
[InlineData(15, "on beşinci")] | ||
[InlineData(16, "on altıncı")] | ||
[InlineData(17, "on yeddinci")] | ||
[InlineData(18, "on səkkizinci")] | ||
[InlineData(19, "on doqquzuncu")] | ||
[InlineData(20, "yirminci")] | ||
[InlineData(21, "yirmi birinci")] | ||
[InlineData(30, "otuzuncu")] | ||
[InlineData(40, "qırxıncı")] | ||
[InlineData(50, "əllinci")] | ||
[InlineData(60, "altmışıncı")] | ||
[InlineData(70, "yetmişinci")] | ||
[InlineData(80, "səksəninci")] | ||
[InlineData(90, "doxsanıncı")] | ||
[InlineData(100, "yüzüncü")] | ||
[InlineData(120, "yüz yirminci")] | ||
[InlineData(121, "yüz yirmi birinci")] | ||
[InlineData(200, "iki yüzüncü")] | ||
[InlineData(221, "iki yüz yirmi birinci")] | ||
[InlineData(300, "üç yüzüncü")] | ||
[InlineData(321, "üç yüz yirmi birinci")] | ||
[InlineData(1000, "mininci")] | ||
[InlineData(1001, "min birinci")] | ||
[InlineData(10000, "on mininci")] | ||
[InlineData(100000, "yüz mininci")] | ||
[InlineData(1000000, "bir milyonuncu")] | ||
[InlineData(1022135, "bir milyon yirmi iki min yüz otuz beşinci")] | ||
public void ToOrdinalWords(int number, string words) | ||
{ | ||
Assert.Equal(words, number.ToOrdinalWords()); | ||
} | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
src/Humanizer.Tests.Shared/Localisation/az/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,102 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.Localisation.az | ||
{ | ||
[UseCulture("az")] | ||
public class TimeSpanHumanizeTests | ||
{ | ||
|
||
[Theory] | ||
[Trait("Translation", "Google")] | ||
[InlineData(366, "1 il")] | ||
[InlineData(731, "2 il")] | ||
[InlineData(1096, "3 il")] | ||
[InlineData(4018, "11 il")] | ||
public void Years(int days, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Year)); | ||
} | ||
|
||
[Theory] | ||
[Trait("Translation", "Google")] | ||
[InlineData(31, "1 ay")] | ||
[InlineData(61, "2 ay")] | ||
[InlineData(92, "3 ay")] | ||
[InlineData(335, "11 ay")] | ||
public void Months(int days, string expected) | ||
{ | ||
Assert.Equal(expected, TimeSpan.FromDays(days).Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Year)); | ||
} | ||
|
||
[Theory] | ||
[InlineData(14, "2 həftə")] | ||
[InlineData(7, "1 həftə")] | ||
public void Weeks(int days, string expected) | ||
{ | ||
var actual = TimeSpan.FromDays(days).Humanize(); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory] | ||
[InlineData(6, "6 gün")] | ||
[InlineData(2, "2 gün")] | ||
public void Days(int days, string expected) | ||
{ | ||
var actual = TimeSpan.FromDays(days).Humanize(); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory] | ||
[InlineData(2, "2 saat")] | ||
[InlineData(1, "1 saat")] | ||
public void Hours(int hours, string expected) | ||
{ | ||
var actual = TimeSpan.FromHours(hours).Humanize(); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory] | ||
[InlineData(2, "2 dəqiqə")] | ||
[InlineData(1, "1 dəqiqə")] | ||
public void Minutes(int minutes, string expected) | ||
{ | ||
var actual = TimeSpan.FromMinutes(minutes).Humanize(); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory] | ||
[InlineData(2, "2 saniyə")] | ||
[InlineData(1, "1 saniyə")] | ||
public void Seconds(int seconds, string expected) | ||
{ | ||
var actual = TimeSpan.FromSeconds(seconds).Humanize(); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory] | ||
[InlineData(2, "2 millisaniyə")] | ||
[InlineData(1, "1 millisaniyə")] | ||
public void Milliseconds(int ms, string expected) | ||
{ | ||
var actual = TimeSpan.FromMilliseconds(ms).Humanize(); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Fact] | ||
public void NoTime() | ||
{ | ||
var noTime = TimeSpan.Zero; | ||
var actual = noTime.Humanize(); | ||
Assert.Equal("0 millisaniyə", actual); | ||
} | ||
|
||
[Fact] | ||
public void NoTimeToWords() | ||
{ | ||
var noTime = TimeSpan.Zero; | ||
var actual = noTime.Humanize(toWords: true); | ||
Assert.Equal("zaman fərqi yoxdur", actual); | ||
} | ||
} | ||
} |
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
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.