diff --git a/src/Humanizer.Tests.Shared/Localisation/tr/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/tr/NumberToWordsTests.cs index e30aa3f0c..891c6cc46 100644 --- a/src/Humanizer.Tests.Shared/Localisation/tr/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/tr/NumberToWordsTests.cs @@ -17,7 +17,8 @@ public class NumberToWordsTests [InlineData("üç bin beş yüz bir", 3501)] [InlineData("bir milyon bir", 1000001)] [InlineData("eksi bir milyon üç yüz kırk altı bin yedi yüz on bir", -1346711)] - public void ToWords(string expected, int number) + [InlineData("dokuz kentilyon iki yüz yirmi üç katrilyon üç yüz yetmiş iki trilyon otuz altı milyar sekiz yüz elli dört milyon yedi yüz yetmiş beş bin sekiz yüz yedi", 9223372036854775807)] + public void ToWords(string expected, long number) { Assert.Equal(expected, number.ToWords()); } diff --git a/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs index 908cb92bd..e36d3c942 100644 --- a/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace Humanizer.Localisation.NumberToWords { @@ -22,11 +21,7 @@ internal class TurkishNumberToWordConverter : GenderlessNumberToWordsConverter public override string Convert(long input) { - if (input > Int32.MaxValue || input < Int32.MinValue) - { - throw new NotImplementedException(); - } - var number = (int)input; + var number = input; if (number == 0) { return UnitsMap[0]; @@ -39,6 +34,24 @@ public override string Convert(long input) var parts = new List(); + if ((number / 1000000000000000000) > 0) + { + parts.Add(string.Format("{0} kentilyon", Convert(number / 1000000000000000000))); + number %= 1000000000000000000; + } + + if ((number / 1000000000000000) > 0) + { + parts.Add(string.Format("{0} katrilyon", Convert(number / 1000000000000000))); + number %= 1000000000000000; + } + + if ((number / 1000000000000) > 0) + { + parts.Add(string.Format("{0} trilyon", Convert(number / 1000000000000))); + number %= 1000000000000; + } + if ((number / 1000000000) > 0) { parts.Add(string.Format("{0} milyar", Convert(number / 1000000000)));