From 95e453ce7e2374b29e99141843eb6ef62b14fd84 Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Fri, 16 Aug 2024 16:58:28 +0100 Subject: [PATCH 1/5] update --- .../Localisation/cy/DataUnitTest.cs | 21 + .../cy/DateToOrdinalWordsTests.cs | 168 +++++ .../Localisation/cy/HeadingTests.cs | 45 ++ .../Localisation/cy/NumberToWordsTests.cs | 56 ++ .../cy/TimeToClockNotationTests.cs | 57 ++ src/Humanizer.sln | 9 +- src/Humanizer/Properties/Resources.cy.resx | 678 ++++++++++++++++++ 7 files changed, 1030 insertions(+), 4 deletions(-) create mode 100644 src/Humanizer.Tests/Localisation/cy/DataUnitTest.cs create mode 100644 src/Humanizer.Tests/Localisation/cy/DateToOrdinalWordsTests.cs create mode 100644 src/Humanizer.Tests/Localisation/cy/HeadingTests.cs create mode 100644 src/Humanizer.Tests/Localisation/cy/NumberToWordsTests.cs create mode 100644 src/Humanizer.Tests/Localisation/cy/TimeToClockNotationTests.cs create mode 100644 src/Humanizer/Properties/Resources.cy.resx diff --git a/src/Humanizer.Tests/Localisation/cy/DataUnitTest.cs b/src/Humanizer.Tests/Localisation/cy/DataUnitTest.cs new file mode 100644 index 000000000..4934d95b2 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/cy/DataUnitTest.cs @@ -0,0 +1,21 @@ +namespace cy; + +[UseCulture("cy")] +public class DataUnitTests +{ + [Fact] + public void BitShort() => + Assert.Equal("5 b", 5.Bits().ToString()); + + [Fact] + public void BitLong() => + Assert.Equal("5 b", 5.Bits().ToFullWords()); + + [Fact] + public void ByteShort() => + Assert.Equal("5 b", 5.Bits().ToString()); + + [Fact] + public void ByteLong() => + Assert.Equal("5 b", 5.Bits().ToFullWords()); +} \ No newline at end of file diff --git a/src/Humanizer.Tests/Localisation/cy/DateToOrdinalWordsTests.cs b/src/Humanizer.Tests/Localisation/cy/DateToOrdinalWordsTests.cs new file mode 100644 index 000000000..10104182e --- /dev/null +++ b/src/Humanizer.Tests/Localisation/cy/DateToOrdinalWordsTests.cs @@ -0,0 +1,168 @@ +namespace cy; + +[UseCulture("cy")] +public class DateToOrdinalWordsTests +{ + [Fact] + public void OrdinalizeString() => + Assert.Equal("1st January 2015", new DateTime(2015, 1, 1).ToOrdinalWords()); + +#if NET6_0_OR_GREATER + + [Fact] + public void OrdinalizeDateOnlyString() => + Assert.Equal("1st January 2015", new DateOnly(2015, 1, 1).ToOrdinalWords()); + +#endif + + + [Fact] + public void DateTime1SecondAgo() => + Assert.Equal("one second ago", DateTime.UtcNow.AddSeconds(-1).Humanize()); + + [Fact] + public void DateTimeMultipleSecondsAgo() => + Assert.Equal("3 seconds ago", DateTime.UtcNow.AddSeconds(-3).Humanize()); + + [Fact] + public void DateTime1MinuteAgo() => + Assert.Equal("a minute ago", DateTime.UtcNow.AddMinutes(-1).Humanize()); + + [Fact] + public void DateTimeMultipleMinutesAgo() => + Assert.Equal("3 minute ago", DateTime.UtcNow.AddMinutes(-3).Humanize()); + + [Fact] + public void DateTime1HourAgo() => + Assert.Equal("an hour ago", DateTime.UtcNow.AddMinutes(-1).Humanize()); + + [Fact] + public void DateTimeMultipleHourAgo() => + Assert.Equal("3 hours ago", DateTime.UtcNow.AddMinutes(-3).Humanize()); + + [Fact] + public void DateTime1DayAgo() => + Assert.Equal("yesterday", DateTime.UtcNow.AddDays(-1).Humanize()); + + [Fact] + public void DateTimeMultipleDaysAgo() => + Assert.Equal("3 days ago", DateTime.UtcNow.AddDays(-3).Humanize()); + + [Fact] + public void DateTime1MonthAgo() => + Assert.Equal("one month ago", DateTime.UtcNow.AddMonths(-1).Humanize()); + + [Fact] + public void DateTimeMultipleMonthsAgo() => + Assert.Equal("3 months ago", DateTime.UtcNow.AddMonths(-3).Humanize()); + + + [Fact] + public void DateTime1YearAgo() => + Assert.Equal("one year ago", DateTime.UtcNow.AddYears(-1).Humanize()); + + [Fact] + public void TimeSpanDays() => + Assert.Equal("2 days", new TimeSpan(48,0,0).Humanize()); + + [Fact] + public void TimeSpanHours() => + Assert.Equal("2 hours", new TimeSpan(2, 0, 0).Humanize()); + + [Fact] + public void TimeSpanMilliseconds() => + Assert.Equal("100 milliseconds", new TimeSpan(0, 0, 0, 0, 100).Humanize()); + + [Fact] + public void TimeSpanMinutes() => + Assert.Equal("5 minutes", new TimeSpan(0, 5, 0).Humanize()); + + [Fact] + public void TimeSpanSeconds() => + Assert.Equal("5 seconds", new TimeSpan(0, 0, 5).Humanize()); + + [Fact] + public void TimeSpan1Day() => + Assert.Equal("1 day", new TimeSpan(24, 0, 0).Humanize()); + + [Fact] + public void TimeSpan1Hour() => + Assert.Equal("1 hour", new TimeSpan(1, 0, 0).Humanize()); + + [Fact] + public void TimeSpan1Millisecond() => + Assert.Equal("1 millisecond", new TimeSpan(0, 0, 0, 0, 1).Humanize()); + + [Fact] + public void TimeSpan1Minute() => + Assert.Equal("1 minute", new TimeSpan(0, 1, 0).Humanize()); + + [Fact] + public void TimeSpan1Second() => + Assert.Equal("1 second", new TimeSpan(0, 1, 0).Humanize()); + + [Fact] + public void TimeSpanZero() => + Assert.Equal("no time", new TimeSpan(0).Humanize()); + + [Fact] + public void TimeSpanMultipleWeeks() => + Assert.Equal("2 weeks", new TimeSpan(14,0,0,0).Humanize()); + + [Fact] + public void TimeSpan1Weeks() => + Assert.Equal("1 week", new TimeSpan(7, 0, 0, 0).Humanize()); + + [Fact] + public void DateTimeMultipleDaysFromNow() => + Assert.Equal("2 days from now", DateTime.UtcNow.AddDays(2).Humanize()); + + [Fact] + public void DateTimeMultipleHoursFromNow() => + Assert.Equal("2 hours from now", DateTime.UtcNow.AddHours(2).Humanize()); + + [Fact] + public void DateTimeMultipleMinutesFromNow() => + Assert.Equal("2 minutes from now", DateTime.UtcNow.AddMinutes(2).Humanize()); + + [Fact] + public void DateTimeMultipleMonthsFromNow() => + Assert.Equal("2 months from now", DateTime.UtcNow.AddMonths(2).Humanize()); + + [Fact] + public void DateTimeMultipleSecondsFromNow() => + Assert.Equal("2 seconds from now", DateTime.UtcNow.AddSeconds(2).Humanize()); + + [Fact] + public void DateTimeMultipleYearsFromNow() => + Assert.Equal("2 years from now", DateTime.UtcNow.AddYears(2).Humanize()); + + [Fact] + public void DateTimeNow() => + Assert.Equal("now", DateTime.UtcNow.Humanize()); + + [Fact] + public void DateTimeTomorrow() => + Assert.Equal("tomorrow", DateTime.UtcNow.AddDays(1).Humanize()); + + [Fact] + public void DateTime1HourFromNow() => + Assert.Equal("an hour from now", DateTime.UtcNow.AddHours(1).Humanize()); + + [Fact] + public void DateTime1MinuteFromNow() => + Assert.Equal("a minute from now", DateTime.UtcNow.AddMinutes(1).Humanize()); + + [Fact] + public void DateTime1MonthFromNow() => + Assert.Equal("one month from now", DateTime.UtcNow.AddMonths(1).Humanize()); + + + [Fact] + public void DateTime1SecondFromNow() => + Assert.Equal("one second from now", DateTime.UtcNow.AddSeconds(1).Humanize()); + + [Fact] + public void DateTime1YearFromNow() => + Assert.Equal("one year from now", DateTime.UtcNow.AddYears(1).Humanize()); +} \ No newline at end of file diff --git a/src/Humanizer.Tests/Localisation/cy/HeadingTests.cs b/src/Humanizer.Tests/Localisation/cy/HeadingTests.cs new file mode 100644 index 000000000..2e6f50b20 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/cy/HeadingTests.cs @@ -0,0 +1,45 @@ +namespace cy; + +[UseCulture("cy")] +public class HeadingTests +{ + [Theory] + [InlineData(0, "north")] + [InlineData(22.5, "north-northeast")] + [InlineData(45, "northeast")] + [InlineData(67.5, "east-northeast")] + [InlineData(90, "east")] + [InlineData(112.5, "east-southeast")] + [InlineData(135, "southeast")] + [InlineData(157.5, "south-southeast")] + [InlineData(180, "south")] + [InlineData(202.5, "south-southwest")] + [InlineData(225, "southwest")] + [InlineData(247.5, "west-southwest")] + [InlineData(270, "west")] + [InlineData(292.5, "west-northwest")] + [InlineData(315, "northwest")] + [InlineData(337.5, "north-northwest")] + public void ToHeadingFull(double heading, string expected) => + Assert.Equal(expected, heading.ToHeading(HeadingStyle.Full)); + + [Theory] + [InlineData(0, "N")] + [InlineData(22.5, "NNE")] + [InlineData(45, "NE")] + [InlineData(67.5, "ENE")] + [InlineData(90, "E")] + [InlineData(112.5, "ESE")] + [InlineData(135, "SE")] + [InlineData(157.5, "SSE")] + [InlineData(180, "S")] + [InlineData(202.5, "SSW")] + [InlineData(225, "SW")] + [InlineData(247.5, "WSW")] + [InlineData(270, "W")] + [InlineData(292.5, "WNW")] + [InlineData(315, "NW")] + [InlineData(337.5, "NNW")] + public void ToHeadingShort(double heading, string expected) => + Assert.Equal(expected, heading.ToHeading()); +} \ No newline at end of file diff --git a/src/Humanizer.Tests/Localisation/cy/NumberToWordsTests.cs b/src/Humanizer.Tests/Localisation/cy/NumberToWordsTests.cs new file mode 100644 index 000000000..c3393a1fa --- /dev/null +++ b/src/Humanizer.Tests/Localisation/cy/NumberToWordsTests.cs @@ -0,0 +1,56 @@ +namespace cy; + +[UseCulture("cy")] +public class NumberToWordsTests +{ + [Theory] + [InlineData(0, "")] + [InlineData(1, "one")] + [InlineData(10, "ten")] + [InlineData(11, "eleven")] + [InlineData(20, "twenty")] + [InlineData(122, "one hundred and twenty two")] + [InlineData(3501, "three thousand five hundred and one")] + [InlineData(100, "one hundred")] + [InlineData(1000, "one thousand")] + [InlineData(1001, "one thousand one")] + [InlineData(100000, "one lakh")] + [InlineData(1000000, "ten lakh")] + [InlineData(10000000, "one crore")] + [InlineData(100000000, "ten crore")] + [InlineData(1000000000, "one hundred crore")] + [InlineData(111, "one hundred and eleven")] + [InlineData(1111, "one thousand one hundred and eleven")] + [InlineData(111111, "one lakh eleven thousand one hundred and eleven")] + [InlineData(1111111, "eleven lakh eleven thousand one hundred and eleven")] + [InlineData(11111111, "one crore eleven lakh eleven thousand one hundred and eleven")] + [InlineData(111111111, "eleven crore eleven lakh eleven thousand one hundred and eleven")] + [InlineData(1111111111, "one hundred and eleven crore eleven lakh eleven thousand one hundred and eleven")] + [InlineData(101, "one hundred and one")] + [InlineData(1011, "one thousand eleven")] + [InlineData(100011, "one lakh eleven")] + [InlineData(1100001, "eleven lakh one")] + [InlineData(11000011, "one crore ten lakh eleven")] + [InlineData(110000011, "eleven crore eleven")] + [InlineData(1100000111, "one hundred and ten crore one hundred and eleven")] + [InlineData(123, "one hundred and twenty three")] + [InlineData(1234, "one thousand two hundred and thirty four")] + [InlineData(12345, "twelve thousand three hundred and forty five")] + [InlineData(123456, "one lakh twenty three thousand four hundred and fifty six")] + [InlineData(1234567, "twelve lakh thirty four thousand five hundred and sixty seven")] + [InlineData(12345678, "one crore twenty three lakh forty five thousand six hundred and seventy eight")] + [InlineData(123456789, "twelve crore thirty four lakh fifty six thousand seven hundred and eighty nine")] + [InlineData(1234567890, "one hundred and twenty three crore forty five lakh sixty seven thousand eight hundred and ninety")] + [InlineData(1000000000000, "one lakh crore")] + [InlineData(45678912345678, "forty five lakh sixty seven thousand eight hundred and ninety one crore twenty three lakh forty five thousand six hundred and seventy eight")] + [InlineData(-7516, "(Negative) seven thousand five hundred and sixteen")] + + public void ToWords(long number, string expected) => + Assert.Equal(expected, number.ToWords()); + + [Theory] + [InlineData(1, "one")] + [InlineData(3501, "three thousand five hundred and one")] + public void ToWordsFeminine(long number, string expected) => + Assert.Equal(expected, number.ToWords(GrammaticalGender.Feminine)); +} \ No newline at end of file diff --git a/src/Humanizer.Tests/Localisation/cy/TimeToClockNotationTests.cs b/src/Humanizer.Tests/Localisation/cy/TimeToClockNotationTests.cs new file mode 100644 index 000000000..ea7487b05 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/cy/TimeToClockNotationTests.cs @@ -0,0 +1,57 @@ +#if NET6_0_OR_GREATER + +namespace cy; + +[UseCulture("cy")] +public class TimeToClockNotationTests +{ + [Theory] + [InlineData(00, 00, "midnight")] + [InlineData(04, 00, "four o'clock")] + [InlineData(05, 01, "five one")] + [InlineData(06, 05, "five past six")] + [InlineData(07, 10, "ten past seven")] + [InlineData(08, 15, "a quarter past eight")] + [InlineData(09, 20, "twenty past nine")] + [InlineData(10, 25, "twenty-five past ten")] + [InlineData(11, 30, "half past eleven")] + [InlineData(12, 00, "noon")] + [InlineData(15, 35, "three thirty-five")] + [InlineData(16, 40, "twenty to five")] + [InlineData(17, 45, "a quarter to six")] + [InlineData(18, 50, "ten to seven")] + [InlineData(19, 55, "five to eight")] + [InlineData(20, 59, "eight fifty-nine")] + public void ConvertToClockNotationTimeOnlyStringEnUs(int hours, int minutes, string expectedResult) + { + var actualResult = new TimeOnly(hours, minutes).ToClockNotation(); + Assert.Equal(expectedResult, actualResult); + } + + [Theory] + [InlineData(00, 00, "midnight")] + [InlineData(04, 00, "four o'clock")] + [InlineData(05, 01, "five o'clock")] + [InlineData(06, 05, "five past six")] + [InlineData(07, 10, "ten past seven")] + [InlineData(08, 15, "a quarter past eight")] + [InlineData(09, 20, "twenty past nine")] + [InlineData(10, 25, "twenty-five past ten")] + [InlineData(11, 30, "half past eleven")] + [InlineData(12, 00, "noon")] + [InlineData(13, 23, "twenty-five past one")] + [InlineData(14, 32, "half past two")] + [InlineData(15, 35, "three thirty-five")] + [InlineData(16, 40, "twenty to five")] + [InlineData(17, 45, "a quarter to six")] + [InlineData(18, 50, "ten to seven")] + [InlineData(19, 55, "five to eight")] + [InlineData(20, 59, "nine o'clock")] + public void ConvertToRoundedClockNotationTimeOnlyStringEnUs(int hours, int minutes, string expectedResult) + { + var actualResult = new TimeOnly(hours, minutes).ToClockNotation(ClockNotationRounding.NearestFiveMinutes); + Assert.Equal(expectedResult, actualResult); + } +} + +#endif diff --git a/src/Humanizer.sln b/src/Humanizer.sln index 359d58ae6..3af1ad886 100644 --- a/src/Humanizer.sln +++ b/src/Humanizer.sln @@ -9,17 +9,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Humanizer", "Humanizer\Huma EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4779A7C9-9ED8-4146-A158-FBE0B1BE09D9}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig ..\.gitattributes = ..\.gitattributes ..\.gitignore = ..\.gitignore Directory.build.props = Directory.build.props + global.json = global.json ..\NuSpecs\Humanizer.Core.nuspec = ..\NuSpecs\Humanizer.Core.nuspec ..\NuSpecs\Humanizer.nuspec = ..\NuSpecs\Humanizer.nuspec ..\license.txt = ..\license.txt - global.json = global.json ..\readme.md = ..\readme.md ..\release_notes.md = ..\release_notes.md ..\version.json = ..\version.json - .editorconfig = .editorconfig EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{97AAE24D-0488-42AE-A585-86D882F23D5F}" @@ -32,6 +32,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{97AAE24D EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{AA449265-E001-486D-A0F4-04ACF0C83DC1}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig ..\NuSpecs\Humanizer.Core.af.nuspec = ..\NuSpecs\Humanizer.Core.af.nuspec ..\NuSpecs\Humanizer.Core.ar.nuspec = ..\NuSpecs\Humanizer.Core.ar.nuspec ..\NuSpecs\Humanizer.Core.az.nuspec = ..\NuSpecs\Humanizer.Core.az.nuspec @@ -57,8 +58,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{AA44 ..\NuSpecs\Humanizer.Core.ja.nuspec = ..\NuSpecs\Humanizer.Core.ja.nuspec ..\NuSpecs\Humanizer.Core.ku.nuspec = ..\NuSpecs\Humanizer.Core.ku.nuspec ..\NuSpecs\Humanizer.Core.lb.nuspec = ..\NuSpecs\Humanizer.Core.lb.nuspec - ..\NuSpecs\Humanizer.Core.lv.nuspec = ..\NuSpecs\Humanizer.Core.lv.nuspec ..\NuSpecs\Humanizer.Core.lt.nuspec = ..\NuSpecs\Humanizer.Core.lt.nuspec + ..\NuSpecs\Humanizer.Core.lv.nuspec = ..\NuSpecs\Humanizer.Core.lv.nuspec ..\NuSpecs\Humanizer.Core.nb-NO.nuspec = ..\NuSpecs\Humanizer.Core.nb-NO.nuspec ..\NuSpecs\Humanizer.Core.nb.nuspec = ..\NuSpecs\Humanizer.Core.nb.nuspec ..\NuSpecs\Humanizer.Core.nl.nuspec = ..\NuSpecs\Humanizer.Core.nl.nuspec @@ -84,7 +85,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{AA44 ..\NuSpecs\Humanizer.nuspec = ..\NuSpecs\Humanizer.nuspec EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{6ACDB92B-AC86-4C59-9114-5DCF9543D945}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{6ACDB92B-AC86-4C59-9114-5DCF9543D945}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Humanizer/Properties/Resources.cy.resx b/src/Humanizer/Properties/Resources.cy.resx new file mode 100644 index 000000000..58cc21e64 --- /dev/null +++ b/src/Humanizer/Properties/Resources.cy.resx @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + bit + + + b + + + beit + + + B + + + gigabeit + + + Prydain Fawr + + + cilobeit + + + KB + + + megabeit + + + MB + + + terabeit + + + TB + + + {0} o ddiwrnodau yn ôl + + + {0} o ddiwrnodau yn ôl + + + {0} o ddiwrnodau yn ôl + + + {0} o ddiwrnodau yn ôl + + + {0} diwrnod yn ôl + + + {0} o ddiwrnodau o nawr + + + {0} o ddiwrnodau o nawr + + + {0} o ddiwrnodau o nawr + + + {0} o ddiwrnodau o nawr + + + {0} diwrnod o nawr + + + {0} o oriau yn ôl + + + {0} o oriau yn ôl + + + {0} o oriau yn ôl + + + {0} o oriau yn ôl + + + {0} awr yn ôl + + + {0} o oriau o nawr + + + {0} o oriau o nawr + + + {0} o oriau o nawr + + + {0} o oriau o nawr + + + {0} awr o nawr + + + {0} o funudau yn ôl + + + {0} o funudau yn ôl + + + {0} o funudau yn ôl + + + {0} o funudau yn ôl + + + {0} munud yn ôl + + + {0} o funudau o nawr + + + {0} o funudau o nawr + + + {0} o funudau o nawr + + + {0} o funudau o nawr + + + {0} munud o nawr + + + {0} o fisoedd yn ôl + + + {0} o fisoedd yn ôl + + + {0} o fisoedd yn ôl + + + {0} o fisoedd yn ôl + + + {0} mis yn ôl + + + {0} o fisoedd o nawr + + + {0} o fisoedd o nawr + + + {0} o fisoedd o nawr + + + {0} o fisoedd o nawr + + + {0} mis o nawr + + + {0} o eiliadau yn ôl + + + {0} o eiliadau yn ôl + + + {0} o eiliadau yn ôl + + + {0} o eiliadau yn ôl + + + {0} eiliad yn ôl + + + {0} o eiliadau o nawr + + + {0} o eiliadau o nawr + + + {0} o eiliadau o nawr + + + {0} o eiliadau o nawr + + + {0} eiliad o nawr + + + {0} o flynyddoedd yn ôl + + + {0} o flynyddoedd yn ôl + + + {0} mlynedd yn ôl + + + {0} o flynyddoedd yn ôl + + + {0} year ago + + + {0} o flynyddoedd o nawr + + + {0} o flynyddoedd o nawr + + + {0} o flynyddoedd o nawr + + + {0} o flynyddoedd o nawr + + + {0} mlynedd o nawr + + + byth + + + nawr + + + ddoe + + + yfory + + + awr yn ôl + + + awr o nawr + + + munud yn ôl + + + munud o nawr + + + un mis yn ôl + + + un mis o nawr + + + un eiliad yn ôl + + + un eiliad o nawr + + + blwyddyn yn ôl + + + blwyddyn o nawr + + + dau ddiwrnod yn ôl + + + dau ddiwrnod o nawr + + + dwyrain + + + dwyrain gogledd-ddwyrain + + + DGogDd + + + dwyrain de-ddwyrain + + + DDeDd + + + D + + + gogledd + + + gogledd-ddwyrain + + + GogDd + + + gogledd gogledd-ddwyrain + + + GogGogDd + + + gogledd gogledd-orllewin + + + GogGogO + + + gogledd-orllewin + + + GogO + + + Gog + + + de + + + de-ddwyrain + + + DeDd + + + de de-ddwyrain + + + DeDeDd + + + de de-orllewin + + + DeDeO + + + de-orllewin + + + DeO + + + De + + + {0} oed + + + {0} o ddiwrnodau + + + {0} o ddiwrnodau + + + {0} o ddiwrnodau + + + {0} o ddiwrnodau + + + {0} diwrnod + + + {0} o oriau + + + {0} o oriau + + + {0} o oriau + + + {0} o oriau + + + {0} awr + + + {0} o filieiliadau + + + {0} o filieiliadau + + + {0} o filieiliadau + + + {0} o filieiliadau + + + {0} milieiliad + + + {0} o funudau + + + {0} o funudau + + + {0} o funudau + + + {0} o funudau + + + {0} munud + + + {0} o fisoedd + + + {0} o fisoedd + + + {0} o fisoedd + + + {0} o fisoedd + + + {0} o fisoedd + + + {0} o eiliadau + + + {0} o eiliadau + + + {0} o fisoedd + + + {0} o eiliadau + + + {0} eiliad + + + {0} o wythnosau + + + {0} o wythnosau + + + {0} o wythnosau + + + {0} o wythnosau + + + {0} wythnos + + + {0} o flynyddoedd + + + {0} o flynyddoedd + + + {0} o flynyddoedd + + + {0} o flynyddoedd + + + {0} o flynyddoedd + + + 1 diwrnod + + + un diwrnod + + + 1 awr + + + un awr + + + 1 milieiliad + + + un milieiliad + + + 1 funud + + + un funud + + + 1 mis + + + un mis + + + 1 eiliad + + + un eiliad + + + 1 wythnos + + + wythnos + + + 1 flwyddyn + + + blwyddyn + + + dim amser + + + d + + + a + + + me + + + isafswm + + + mis + + + e + + + wythnos + + + b + + + gorllewin + + + gorllewin gogledd-orllewin + + + GGogO + + + gorllewin de-orllewin + + + GDeO + + + G + + \ No newline at end of file From b36dcddcdb58be3141522470b4917ae82d37bce6 Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Fri, 16 Aug 2024 17:01:25 +0100 Subject: [PATCH 2/5] remove tests --- src/Humanizer.Tests/Humanizer.Tests.csproj | 4 + .../Localisation/cy/DataUnitTest.cs | 21 --- .../cy/DateToOrdinalWordsTests.cs | 168 ------------------ .../Localisation/cy/HeadingTests.cs | 45 ----- .../Localisation/cy/NumberToWordsTests.cs | 56 ------ .../cy/TimeToClockNotationTests.cs | 57 ------ 6 files changed, 4 insertions(+), 347 deletions(-) delete mode 100644 src/Humanizer.Tests/Localisation/cy/DataUnitTest.cs delete mode 100644 src/Humanizer.Tests/Localisation/cy/DateToOrdinalWordsTests.cs delete mode 100644 src/Humanizer.Tests/Localisation/cy/HeadingTests.cs delete mode 100644 src/Humanizer.Tests/Localisation/cy/NumberToWordsTests.cs delete mode 100644 src/Humanizer.Tests/Localisation/cy/TimeToClockNotationTests.cs diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index 7bcc17153..4dce609e3 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -19,4 +19,8 @@ + + + + diff --git a/src/Humanizer.Tests/Localisation/cy/DataUnitTest.cs b/src/Humanizer.Tests/Localisation/cy/DataUnitTest.cs deleted file mode 100644 index 4934d95b2..000000000 --- a/src/Humanizer.Tests/Localisation/cy/DataUnitTest.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace cy; - -[UseCulture("cy")] -public class DataUnitTests -{ - [Fact] - public void BitShort() => - Assert.Equal("5 b", 5.Bits().ToString()); - - [Fact] - public void BitLong() => - Assert.Equal("5 b", 5.Bits().ToFullWords()); - - [Fact] - public void ByteShort() => - Assert.Equal("5 b", 5.Bits().ToString()); - - [Fact] - public void ByteLong() => - Assert.Equal("5 b", 5.Bits().ToFullWords()); -} \ No newline at end of file diff --git a/src/Humanizer.Tests/Localisation/cy/DateToOrdinalWordsTests.cs b/src/Humanizer.Tests/Localisation/cy/DateToOrdinalWordsTests.cs deleted file mode 100644 index 10104182e..000000000 --- a/src/Humanizer.Tests/Localisation/cy/DateToOrdinalWordsTests.cs +++ /dev/null @@ -1,168 +0,0 @@ -namespace cy; - -[UseCulture("cy")] -public class DateToOrdinalWordsTests -{ - [Fact] - public void OrdinalizeString() => - Assert.Equal("1st January 2015", new DateTime(2015, 1, 1).ToOrdinalWords()); - -#if NET6_0_OR_GREATER - - [Fact] - public void OrdinalizeDateOnlyString() => - Assert.Equal("1st January 2015", new DateOnly(2015, 1, 1).ToOrdinalWords()); - -#endif - - - [Fact] - public void DateTime1SecondAgo() => - Assert.Equal("one second ago", DateTime.UtcNow.AddSeconds(-1).Humanize()); - - [Fact] - public void DateTimeMultipleSecondsAgo() => - Assert.Equal("3 seconds ago", DateTime.UtcNow.AddSeconds(-3).Humanize()); - - [Fact] - public void DateTime1MinuteAgo() => - Assert.Equal("a minute ago", DateTime.UtcNow.AddMinutes(-1).Humanize()); - - [Fact] - public void DateTimeMultipleMinutesAgo() => - Assert.Equal("3 minute ago", DateTime.UtcNow.AddMinutes(-3).Humanize()); - - [Fact] - public void DateTime1HourAgo() => - Assert.Equal("an hour ago", DateTime.UtcNow.AddMinutes(-1).Humanize()); - - [Fact] - public void DateTimeMultipleHourAgo() => - Assert.Equal("3 hours ago", DateTime.UtcNow.AddMinutes(-3).Humanize()); - - [Fact] - public void DateTime1DayAgo() => - Assert.Equal("yesterday", DateTime.UtcNow.AddDays(-1).Humanize()); - - [Fact] - public void DateTimeMultipleDaysAgo() => - Assert.Equal("3 days ago", DateTime.UtcNow.AddDays(-3).Humanize()); - - [Fact] - public void DateTime1MonthAgo() => - Assert.Equal("one month ago", DateTime.UtcNow.AddMonths(-1).Humanize()); - - [Fact] - public void DateTimeMultipleMonthsAgo() => - Assert.Equal("3 months ago", DateTime.UtcNow.AddMonths(-3).Humanize()); - - - [Fact] - public void DateTime1YearAgo() => - Assert.Equal("one year ago", DateTime.UtcNow.AddYears(-1).Humanize()); - - [Fact] - public void TimeSpanDays() => - Assert.Equal("2 days", new TimeSpan(48,0,0).Humanize()); - - [Fact] - public void TimeSpanHours() => - Assert.Equal("2 hours", new TimeSpan(2, 0, 0).Humanize()); - - [Fact] - public void TimeSpanMilliseconds() => - Assert.Equal("100 milliseconds", new TimeSpan(0, 0, 0, 0, 100).Humanize()); - - [Fact] - public void TimeSpanMinutes() => - Assert.Equal("5 minutes", new TimeSpan(0, 5, 0).Humanize()); - - [Fact] - public void TimeSpanSeconds() => - Assert.Equal("5 seconds", new TimeSpan(0, 0, 5).Humanize()); - - [Fact] - public void TimeSpan1Day() => - Assert.Equal("1 day", new TimeSpan(24, 0, 0).Humanize()); - - [Fact] - public void TimeSpan1Hour() => - Assert.Equal("1 hour", new TimeSpan(1, 0, 0).Humanize()); - - [Fact] - public void TimeSpan1Millisecond() => - Assert.Equal("1 millisecond", new TimeSpan(0, 0, 0, 0, 1).Humanize()); - - [Fact] - public void TimeSpan1Minute() => - Assert.Equal("1 minute", new TimeSpan(0, 1, 0).Humanize()); - - [Fact] - public void TimeSpan1Second() => - Assert.Equal("1 second", new TimeSpan(0, 1, 0).Humanize()); - - [Fact] - public void TimeSpanZero() => - Assert.Equal("no time", new TimeSpan(0).Humanize()); - - [Fact] - public void TimeSpanMultipleWeeks() => - Assert.Equal("2 weeks", new TimeSpan(14,0,0,0).Humanize()); - - [Fact] - public void TimeSpan1Weeks() => - Assert.Equal("1 week", new TimeSpan(7, 0, 0, 0).Humanize()); - - [Fact] - public void DateTimeMultipleDaysFromNow() => - Assert.Equal("2 days from now", DateTime.UtcNow.AddDays(2).Humanize()); - - [Fact] - public void DateTimeMultipleHoursFromNow() => - Assert.Equal("2 hours from now", DateTime.UtcNow.AddHours(2).Humanize()); - - [Fact] - public void DateTimeMultipleMinutesFromNow() => - Assert.Equal("2 minutes from now", DateTime.UtcNow.AddMinutes(2).Humanize()); - - [Fact] - public void DateTimeMultipleMonthsFromNow() => - Assert.Equal("2 months from now", DateTime.UtcNow.AddMonths(2).Humanize()); - - [Fact] - public void DateTimeMultipleSecondsFromNow() => - Assert.Equal("2 seconds from now", DateTime.UtcNow.AddSeconds(2).Humanize()); - - [Fact] - public void DateTimeMultipleYearsFromNow() => - Assert.Equal("2 years from now", DateTime.UtcNow.AddYears(2).Humanize()); - - [Fact] - public void DateTimeNow() => - Assert.Equal("now", DateTime.UtcNow.Humanize()); - - [Fact] - public void DateTimeTomorrow() => - Assert.Equal("tomorrow", DateTime.UtcNow.AddDays(1).Humanize()); - - [Fact] - public void DateTime1HourFromNow() => - Assert.Equal("an hour from now", DateTime.UtcNow.AddHours(1).Humanize()); - - [Fact] - public void DateTime1MinuteFromNow() => - Assert.Equal("a minute from now", DateTime.UtcNow.AddMinutes(1).Humanize()); - - [Fact] - public void DateTime1MonthFromNow() => - Assert.Equal("one month from now", DateTime.UtcNow.AddMonths(1).Humanize()); - - - [Fact] - public void DateTime1SecondFromNow() => - Assert.Equal("one second from now", DateTime.UtcNow.AddSeconds(1).Humanize()); - - [Fact] - public void DateTime1YearFromNow() => - Assert.Equal("one year from now", DateTime.UtcNow.AddYears(1).Humanize()); -} \ No newline at end of file diff --git a/src/Humanizer.Tests/Localisation/cy/HeadingTests.cs b/src/Humanizer.Tests/Localisation/cy/HeadingTests.cs deleted file mode 100644 index 2e6f50b20..000000000 --- a/src/Humanizer.Tests/Localisation/cy/HeadingTests.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace cy; - -[UseCulture("cy")] -public class HeadingTests -{ - [Theory] - [InlineData(0, "north")] - [InlineData(22.5, "north-northeast")] - [InlineData(45, "northeast")] - [InlineData(67.5, "east-northeast")] - [InlineData(90, "east")] - [InlineData(112.5, "east-southeast")] - [InlineData(135, "southeast")] - [InlineData(157.5, "south-southeast")] - [InlineData(180, "south")] - [InlineData(202.5, "south-southwest")] - [InlineData(225, "southwest")] - [InlineData(247.5, "west-southwest")] - [InlineData(270, "west")] - [InlineData(292.5, "west-northwest")] - [InlineData(315, "northwest")] - [InlineData(337.5, "north-northwest")] - public void ToHeadingFull(double heading, string expected) => - Assert.Equal(expected, heading.ToHeading(HeadingStyle.Full)); - - [Theory] - [InlineData(0, "N")] - [InlineData(22.5, "NNE")] - [InlineData(45, "NE")] - [InlineData(67.5, "ENE")] - [InlineData(90, "E")] - [InlineData(112.5, "ESE")] - [InlineData(135, "SE")] - [InlineData(157.5, "SSE")] - [InlineData(180, "S")] - [InlineData(202.5, "SSW")] - [InlineData(225, "SW")] - [InlineData(247.5, "WSW")] - [InlineData(270, "W")] - [InlineData(292.5, "WNW")] - [InlineData(315, "NW")] - [InlineData(337.5, "NNW")] - public void ToHeadingShort(double heading, string expected) => - Assert.Equal(expected, heading.ToHeading()); -} \ No newline at end of file diff --git a/src/Humanizer.Tests/Localisation/cy/NumberToWordsTests.cs b/src/Humanizer.Tests/Localisation/cy/NumberToWordsTests.cs deleted file mode 100644 index c3393a1fa..000000000 --- a/src/Humanizer.Tests/Localisation/cy/NumberToWordsTests.cs +++ /dev/null @@ -1,56 +0,0 @@ -namespace cy; - -[UseCulture("cy")] -public class NumberToWordsTests -{ - [Theory] - [InlineData(0, "")] - [InlineData(1, "one")] - [InlineData(10, "ten")] - [InlineData(11, "eleven")] - [InlineData(20, "twenty")] - [InlineData(122, "one hundred and twenty two")] - [InlineData(3501, "three thousand five hundred and one")] - [InlineData(100, "one hundred")] - [InlineData(1000, "one thousand")] - [InlineData(1001, "one thousand one")] - [InlineData(100000, "one lakh")] - [InlineData(1000000, "ten lakh")] - [InlineData(10000000, "one crore")] - [InlineData(100000000, "ten crore")] - [InlineData(1000000000, "one hundred crore")] - [InlineData(111, "one hundred and eleven")] - [InlineData(1111, "one thousand one hundred and eleven")] - [InlineData(111111, "one lakh eleven thousand one hundred and eleven")] - [InlineData(1111111, "eleven lakh eleven thousand one hundred and eleven")] - [InlineData(11111111, "one crore eleven lakh eleven thousand one hundred and eleven")] - [InlineData(111111111, "eleven crore eleven lakh eleven thousand one hundred and eleven")] - [InlineData(1111111111, "one hundred and eleven crore eleven lakh eleven thousand one hundred and eleven")] - [InlineData(101, "one hundred and one")] - [InlineData(1011, "one thousand eleven")] - [InlineData(100011, "one lakh eleven")] - [InlineData(1100001, "eleven lakh one")] - [InlineData(11000011, "one crore ten lakh eleven")] - [InlineData(110000011, "eleven crore eleven")] - [InlineData(1100000111, "one hundred and ten crore one hundred and eleven")] - [InlineData(123, "one hundred and twenty three")] - [InlineData(1234, "one thousand two hundred and thirty four")] - [InlineData(12345, "twelve thousand three hundred and forty five")] - [InlineData(123456, "one lakh twenty three thousand four hundred and fifty six")] - [InlineData(1234567, "twelve lakh thirty four thousand five hundred and sixty seven")] - [InlineData(12345678, "one crore twenty three lakh forty five thousand six hundred and seventy eight")] - [InlineData(123456789, "twelve crore thirty four lakh fifty six thousand seven hundred and eighty nine")] - [InlineData(1234567890, "one hundred and twenty three crore forty five lakh sixty seven thousand eight hundred and ninety")] - [InlineData(1000000000000, "one lakh crore")] - [InlineData(45678912345678, "forty five lakh sixty seven thousand eight hundred and ninety one crore twenty three lakh forty five thousand six hundred and seventy eight")] - [InlineData(-7516, "(Negative) seven thousand five hundred and sixteen")] - - public void ToWords(long number, string expected) => - Assert.Equal(expected, number.ToWords()); - - [Theory] - [InlineData(1, "one")] - [InlineData(3501, "three thousand five hundred and one")] - public void ToWordsFeminine(long number, string expected) => - Assert.Equal(expected, number.ToWords(GrammaticalGender.Feminine)); -} \ No newline at end of file diff --git a/src/Humanizer.Tests/Localisation/cy/TimeToClockNotationTests.cs b/src/Humanizer.Tests/Localisation/cy/TimeToClockNotationTests.cs deleted file mode 100644 index ea7487b05..000000000 --- a/src/Humanizer.Tests/Localisation/cy/TimeToClockNotationTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -#if NET6_0_OR_GREATER - -namespace cy; - -[UseCulture("cy")] -public class TimeToClockNotationTests -{ - [Theory] - [InlineData(00, 00, "midnight")] - [InlineData(04, 00, "four o'clock")] - [InlineData(05, 01, "five one")] - [InlineData(06, 05, "five past six")] - [InlineData(07, 10, "ten past seven")] - [InlineData(08, 15, "a quarter past eight")] - [InlineData(09, 20, "twenty past nine")] - [InlineData(10, 25, "twenty-five past ten")] - [InlineData(11, 30, "half past eleven")] - [InlineData(12, 00, "noon")] - [InlineData(15, 35, "three thirty-five")] - [InlineData(16, 40, "twenty to five")] - [InlineData(17, 45, "a quarter to six")] - [InlineData(18, 50, "ten to seven")] - [InlineData(19, 55, "five to eight")] - [InlineData(20, 59, "eight fifty-nine")] - public void ConvertToClockNotationTimeOnlyStringEnUs(int hours, int minutes, string expectedResult) - { - var actualResult = new TimeOnly(hours, minutes).ToClockNotation(); - Assert.Equal(expectedResult, actualResult); - } - - [Theory] - [InlineData(00, 00, "midnight")] - [InlineData(04, 00, "four o'clock")] - [InlineData(05, 01, "five o'clock")] - [InlineData(06, 05, "five past six")] - [InlineData(07, 10, "ten past seven")] - [InlineData(08, 15, "a quarter past eight")] - [InlineData(09, 20, "twenty past nine")] - [InlineData(10, 25, "twenty-five past ten")] - [InlineData(11, 30, "half past eleven")] - [InlineData(12, 00, "noon")] - [InlineData(13, 23, "twenty-five past one")] - [InlineData(14, 32, "half past two")] - [InlineData(15, 35, "three thirty-five")] - [InlineData(16, 40, "twenty to five")] - [InlineData(17, 45, "a quarter to six")] - [InlineData(18, 50, "ten to seven")] - [InlineData(19, 55, "five to eight")] - [InlineData(20, 59, "nine o'clock")] - public void ConvertToRoundedClockNotationTimeOnlyStringEnUs(int hours, int minutes, string expectedResult) - { - var actualResult = new TimeOnly(hours, minutes).ToClockNotation(ClockNotationRounding.NearestFiveMinutes); - Assert.Equal(expectedResult, actualResult); - } -} - -#endif From e8e2c2664f1f6ddf563317e794c23835f6f7be74 Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Fri, 16 Aug 2024 17:04:46 +0100 Subject: [PATCH 3/5] fix csproj --- src/Humanizer.Tests/Humanizer.Tests.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index 4dce609e3..7bcc17153 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -19,8 +19,4 @@ - - - - From 4d8fc3bb45c02927f39a3214adb3af3119937148 Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Fri, 16 Aug 2024 17:43:37 +0100 Subject: [PATCH 4/5] nuspec added --- NuSpecs/Humanizer.Core.cy.nuspec | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 NuSpecs/Humanizer.Core.cy.nuspec diff --git a/NuSpecs/Humanizer.Core.cy.nuspec b/NuSpecs/Humanizer.Core.cy.nuspec new file mode 100644 index 000000000..534b97536 --- /dev/null +++ b/NuSpecs/Humanizer.Core.cy.nuspec @@ -0,0 +1,25 @@ + + + + Humanizer.Core.cy + $version$ + Humanizer Locale (cy) + Mehdi Khalili, Claire Novotny + https://github.com/Humanizr/Humanizer + logo.png + false + Humanizer Locale Welsh (cy) + Copyright (c) .NET Foundation and Contributors + MIT + + cy + + + + + + + + + + \ No newline at end of file From fe2c97df80609ea0a95e7edb13e7dd5795987cb2 Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Mon, 19 Aug 2024 15:25:27 +0100 Subject: [PATCH 5/5] updated translations --- src/Humanizer/Properties/Resources.cy.resx | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Humanizer/Properties/Resources.cy.resx b/src/Humanizer/Properties/Resources.cy.resx index 58cc21e64..9c2f048ec 100644 --- a/src/Humanizer/Properties/Resources.cy.resx +++ b/src/Humanizer/Properties/Resources.cy.resx @@ -133,7 +133,7 @@ gigabeit - Prydain Fawr + GB cilobeit @@ -184,31 +184,31 @@ {0} diwrnod o nawr - {0} o oriau yn ôl + {0} awr yn ôl - {0} o oriau yn ôl + {0} awr yn ôl - {0} o oriau yn ôl + {0} awr yn ôl - {0} o oriau yn ôl + {0} awr yn ôl {0} awr yn ôl - {0} o oriau o nawr + {0} awr o nawr - {0} o oriau o nawr + {0} awr o nawr - {0} o oriau o nawr + {0} awr o nawr - {0} o oriau o nawr + {0} awr o nawr {0} awr o nawr @@ -274,31 +274,31 @@ {0} mis o nawr - {0} o eiliadau yn ôl + {0} eiliad yn ôl - {0} o eiliadau yn ôl + {0} eiliad yn ôl - {0} o eiliadau yn ôl + {0} eiliad yn ôl - {0} o eiliadau yn ôl + {0} eiliad yn ôl {0} eiliad yn ôl - {0} o eiliadau o nawr + {0} eiliad o nawr - {0} o eiliadau o nawr + {0} eiliad o nawr - {0} o eiliadau o nawr + {0} eiliad o nawr - {0} o eiliadau o nawr + {0} eiliad o nawr {0} eiliad o nawr @@ -478,16 +478,16 @@ {0} diwrnod - {0} o oriau + {0} awr - {0} o oriau + {0} awr - {0} o oriau + {0} awr - {0} o oriau + {0} awr {0} awr @@ -538,31 +538,31 @@ {0} o fisoedd - {0} o eiliadau + {0} eiliad - {0} o eiliadau + {0} eiliad {0} o fisoedd - {0} o eiliadau + {0} eiliad {0} eiliad - {0} o wythnosau + {0} wythnos - {0} o wythnosau + {0} wythnos - {0} o wythnosau + {0} wythnos - {0} o wythnosau + {0} wythnos {0} wythnos @@ -643,7 +643,7 @@ me - isafswm + mun mis