Skip to content

Commit

Permalink
fixes Humanizr#898 Added DateToOrdinalWordsTests for Latvian language
Browse files Browse the repository at this point in the history
  • Loading branch information
vnsharanin committed Sep 30, 2021
1 parent d3da1b8 commit f4bb6b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Localisation\ja\DateHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\ja\NumberToWordsTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\ja\TimeSpanHumanizeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\lv\DateToOrdinalWordsTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\lv\NumberToWordsTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\ku\NumberToWordsTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Localisation\ku\TimeSpanHumanizeTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using Xunit;

namespace Humanizer.Tests.Localisation.lv
{
[UseCulture("lv")]
public class DateToOrdinalWordsTests
{
[Fact]
public void OrdinalizeString()
{
Assert.Equal("1 janvāris 2015", new DateTime(2015, 1, 1).ToOrdinalWords());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal class LatvianNumberToWordsConverter : GenderedNumberToWordsConverter
private static readonly string[] HundredsMap = { "nulle", "simt", "divsimt", "trīssimt", "četrsimt", "piecsimt", "sešsimt", "septiņsimt", "astoņsimt", "deviņsimt" };
private static readonly string[] UnitsOrdinal = { string.Empty, "pirm", "otr", "treš", "ceturt", "piekt", "sest", "septīt", "astot", "devīt", "desmit", "vienpadsmit", "divpadsmit", "trīspadsmit", "četrpadsmit", "piecpadsmit", "sešpadsmit", "septiņpadsmit", "astoņpadsmit", "deviņpadsmit", "divdesmit" };

public override string Convert(long input, GrammaticalGender gender)
public override string Convert(long input, GrammaticalGender gender, bool addAnd = true)
{
if (input > int.MaxValue || input < int.MinValue)
{
Expand Down

0 comments on commit f4bb6b4

Please sign in to comment.