From 9ed48438bcffbb1387cbf6db48b4027194027af1 Mon Sep 17 00:00:00 2001 From: Dean Milojevic Date: Thu, 21 May 2015 21:24:23 +0200 Subject: [PATCH 1/2] Added support for Serbian language, ToWords() --- src/Humanizer.Tests/Humanizer.Tests.csproj | 1 + .../Localisation/sr-Latn/NumberToWordsTest.cs | 95 +++++++++ .../NumberToWordsConverterRegistry.cs | 1 + src/Humanizer/Humanizer.csproj | 1 + .../SerbianNumberToWordsConverter.cs | 184 ++++++++++++++++++ 5 files changed, 282 insertions(+) create mode 100644 src/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs create mode 100644 src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index 2e9aa81c0..7b5d83fb4 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -134,6 +134,7 @@ + diff --git a/src/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs b/src/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs new file mode 100644 index 000000000..bae5f4c15 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using Xunit; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.sr_Latn +{ + public class NumberToWordsTest : AmbientCulture + { + public NumberToWordsTest() : base("sr-Latn") { } + + [Theory] + [InlineData(0, "nula")] + [InlineData(1, "jedan")] + [InlineData(2, "dva")] + [InlineData(3, "tri")] + [InlineData(4, "četiri")] + [InlineData(5, "pet")] + [InlineData(6, "šest")] + [InlineData(7, "sedam")] + [InlineData(8, "osam")] + [InlineData(9, "devet")] + [InlineData(10, "deset")] + [InlineData(20, "dvadeset")] + [InlineData(30, "trideset")] + [InlineData(40, "četrdeset")] + [InlineData(50, "petdeset")] + [InlineData(60, "šestdeset")] + [InlineData(70, "sedamdeset")] + [InlineData(80, "osamdeset")] + [InlineData(90, "devetdeset")] + [InlineData(100, "sto")] + [InlineData(200, "dvesto")] + [InlineData(1000, "hiljadu")] + [InlineData(10000, "deset hiljada")] + [InlineData(100000, "sto hiljada")] + [InlineData(1000000, "milion")] + [InlineData(10000000, "deset miliona")] + [InlineData(100000000, "sto miliona")] + [InlineData(1000000000, "milijarda")] + [InlineData(2000000000, "dve milijarde")] + [InlineData(15, "petnaest")] + [InlineData(43, "četrdeset tri")] + [InlineData(81, "osamdeset jedan")] + [InlineData(213, "dvesto trinaest")] + [InlineData(547, "petsto četrdeset sedam")] + public void ToWords(int number, string expected) + { + Assert.Equal(expected, number.ToWords(new CultureInfo("sr-Latn"))); + } + + [Theory] + [InlineData(0, "нула")] + [InlineData(1, "један")] + [InlineData(2, "два")] + [InlineData(3, "три")] + [InlineData(4, "четири")] + [InlineData(5, "пет")] + [InlineData(6, "шест")] + [InlineData(7, "седам")] + [InlineData(8, "осам")] + [InlineData(9, "девет")] + [InlineData(10, "десет")] + [InlineData(20, "двадесет")] + [InlineData(30, "тридесет")] + [InlineData(40, "четрдесет")] + [InlineData(50, "петдесет")] + [InlineData(60, "шестдесет")] + [InlineData(70, "седамдесет")] + [InlineData(80, "осамдесет")] + [InlineData(90, "деветдесет")] + [InlineData(100, "сто")] + [InlineData(200, "двесто")] + [InlineData(1000, "хиљаду")] + [InlineData(10000, "десет хиљада")] + [InlineData(100000, "сто хиљада")] + [InlineData(1000000, "милион")] + [InlineData(10000000, "десет милиона")] + [InlineData(100000000, "сто милиона")] + [InlineData(1000000000, "милијарда")] + [InlineData(2000000000, "две милијарде")] + [InlineData(15, "петнаест")] + [InlineData(43, "четрдесет три")] + [InlineData(81, "осамдесет један")] + [InlineData(213, "двесто тринаест")] + [InlineData(547, "петсто четрдесет седам")] + public void ToWordsSr(int number, string expected) + { + Assert.Equal(expected, number.ToWords()); + } + } +} diff --git a/src/Humanizer/Configuration/NumberToWordsConverterRegistry.cs b/src/Humanizer/Configuration/NumberToWordsConverterRegistry.cs index 16e0e9a7b..28d26a7e5 100644 --- a/src/Humanizer/Configuration/NumberToWordsConverterRegistry.cs +++ b/src/Humanizer/Configuration/NumberToWordsConverterRegistry.cs @@ -23,6 +23,7 @@ internal class NumberToWordsConverterRegistry : LocaliserRegistry new SerbianNumberToWordsConverter(culture)); } } } diff --git a/src/Humanizer/Humanizer.csproj b/src/Humanizer/Humanizer.csproj index a9501157f..c309c197e 100644 --- a/src/Humanizer/Humanizer.csproj +++ b/src/Humanizer/Humanizer.csproj @@ -74,6 +74,7 @@ + diff --git a/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs new file mode 100644 index 000000000..104869d88 --- /dev/null +++ b/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; + +namespace Humanizer.Localisation.NumberToWords +{ + internal class SerbianNumberToWordsConverter : GenderlessNumberToWordsConverter + { + private static readonly string SR_NAME = "sr"; + private static readonly string SR_LATN_NAME = "sr-Latn"; + + private static string[] UnitsMap = new string[1]; + private static string[] TensMap = new string[1]; + + private static readonly string[] UnitsMapSr = { "нула", "један", "два", "три", "четири", "пет", "шест", "седам", "осам", "девет", "десет", "једанест", "дванаест", "тринаест", "четрнаест", "петнаест", "шестнаест", "седамнаест", "осамнаест", "деветнаест" }; + private static readonly string[] TensMapSr = { "нула", "десет", "двадесет", "тридесет", "четрдесет", "петдесет", "шестдесет", "седамдесет", "осамдесет", "деветдесет" }; + + private static readonly string[] UnitsMapLatn = { "nula", "jedan", "dva", "tri", "četiri", "pet", "šest", "sedam", "osam", "devet", "deset", "jedanaest", "dvanaest", "trinaest", "četrnaestt", "petnaest", "šestnaest", "sedemnaest", "osemnaest", "devetnaest" }; + private static readonly string[] TensMapLatn = { "nula", "deset", "dvadeset", "trideset", "četrdeset", "petdeset", "šestdeset", "sedamdeset", "osamdeset", "devetdeset" }; + + private readonly CultureInfo _culture; + + public SerbianNumberToWordsConverter(CultureInfo culture) + { + _culture = culture; + + if (_culture != null && _culture.Name.Equals(SR_LATN_NAME)) + { + UnitsMap = UnitsMapLatn; + TensMap = TensMapLatn; + } + else + { + UnitsMap = UnitsMapSr; + TensMap = TensMapSr; + } + } + + public override string Convert(int number) + { + bool isLatn = (_culture != null &&_culture.Name == SR_LATN_NAME); + + if (number == 0) + { + return (isLatn) ? "nula" : "нула"; + } + + if (number < 0) + { + return string.Format("- {0}", Convert(-number)); + } + + var parts = new List(); + var billions = number / 1000000000; + + if (billions > 0) + { + if (isLatn) + { + parts.Add(Part("milijarda", "dve milijarde", "{0} milijarde", "{0} milijarda", billions)); + } + else + { + parts.Add(Part("милијарда", "две милијарде", "{0} милијарде", "{0} милијарда", billions)); + } + + number %= 1000000000; + + if (number > 0) + { + parts.Add(" "); + } + } + + var millions = number / 1000000; + + if (millions > 0) + { + if (isLatn) + { + parts.Add(Part("milion", "dva miliona", "{0} miliona", "{0} miliona", millions)); + } + else + { + parts.Add(Part("милион", "два милиона", "{0} милиона", "{0} милиона", millions)); + } + + number %= 1000000; + + if (number > 0) + { + parts.Add(" "); + } + } + + var thousands = number / 1000; + + if (thousands > 0) + { + if (isLatn) + { + parts.Add(Part("hiljadu", "dve hiljade", "{0} hiljade", "{0} hiljada", thousands)); + } + else + { + parts.Add(Part("хиљаду", "две хиљаде", "{0} хиљаде", "{0} хиљада", thousands)); + } + + number %= 1000; + + if (number > 0) + { + parts.Add(" "); + } + } + + var hundreds = number / 100; + + if (hundreds > 0) + { + if (isLatn) + { + parts.Add(Part("sto", "dvesto", "{0}sto", "{0}sto", hundreds)); + } + else + { + parts.Add(Part("сто", "двесто", "{0}сто", "{0}сто", hundreds)); + } + number %= 100; + + if (number > 0) + { + parts.Add(" "); + } + } + + if (number > 0) + { + if (number < 20) + { + parts.Add(UnitsMap[number]); + } + else + { + parts.Add(TensMap[number / 10]); + + var units = number % 10; + + if (units > 0) + { + parts.Add(string.Format(" {0}", UnitsMap[units])); + } + } + } + + return string.Join("", parts); + } + + public override string ConvertToOrdinal(int number) + { + //TODO: In progress + return number.ToString(_culture); + } + + private string Part(string singular, string dual, string trialQuadral, string plural, int number) + { + switch (number) + { + case 1: + return singular; + case 2: + return dual; + case 3: + case 4: + return string.Format(trialQuadral, Convert(number)); + default: + return string.Format(plural, Convert(number)); + } + } + } + +} From a447bf8690ab33837dcd1a5d37936b5732fb9e8a Mon Sep 17 00:00:00 2001 From: Dean Milojevic Date: Thu, 21 May 2015 21:54:36 +0200 Subject: [PATCH 2/2] Refactored in two separate files. Also, unit tests are separated. --- src/Humanizer.Tests/Humanizer.Tests.csproj | 1 + .../Localisation/sr-Latn/NumberToWordsTest.cs | 40 ------ .../Localisation/sr/NumberToWordsTest.cs | 55 ++++++++ .../NumberToWordsConverterRegistry.cs | 3 +- src/Humanizer/Humanizer.csproj | 1 + .../SerbianCyrlNumberToWordsConverter.cs | 131 ++++++++++++++++++ .../SerbianNumberToWordsConverter.cs | 67 +-------- 7 files changed, 197 insertions(+), 101 deletions(-) create mode 100644 src/Humanizer.Tests/Localisation/sr/NumberToWordsTest.cs create mode 100644 src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index 7b5d83fb4..c65f33d78 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -137,6 +137,7 @@ + diff --git a/src/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs b/src/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs index bae5f4c15..1bb5581a7 100644 --- a/src/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs +++ b/src/Humanizer.Tests/Localisation/sr-Latn/NumberToWordsTest.cs @@ -48,46 +48,6 @@ public NumberToWordsTest() : base("sr-Latn") { } [InlineData(213, "dvesto trinaest")] [InlineData(547, "petsto četrdeset sedam")] public void ToWords(int number, string expected) - { - Assert.Equal(expected, number.ToWords(new CultureInfo("sr-Latn"))); - } - - [Theory] - [InlineData(0, "нула")] - [InlineData(1, "један")] - [InlineData(2, "два")] - [InlineData(3, "три")] - [InlineData(4, "четири")] - [InlineData(5, "пет")] - [InlineData(6, "шест")] - [InlineData(7, "седам")] - [InlineData(8, "осам")] - [InlineData(9, "девет")] - [InlineData(10, "десет")] - [InlineData(20, "двадесет")] - [InlineData(30, "тридесет")] - [InlineData(40, "четрдесет")] - [InlineData(50, "петдесет")] - [InlineData(60, "шестдесет")] - [InlineData(70, "седамдесет")] - [InlineData(80, "осамдесет")] - [InlineData(90, "деветдесет")] - [InlineData(100, "сто")] - [InlineData(200, "двесто")] - [InlineData(1000, "хиљаду")] - [InlineData(10000, "десет хиљада")] - [InlineData(100000, "сто хиљада")] - [InlineData(1000000, "милион")] - [InlineData(10000000, "десет милиона")] - [InlineData(100000000, "сто милиона")] - [InlineData(1000000000, "милијарда")] - [InlineData(2000000000, "две милијарде")] - [InlineData(15, "петнаест")] - [InlineData(43, "четрдесет три")] - [InlineData(81, "осамдесет један")] - [InlineData(213, "двесто тринаест")] - [InlineData(547, "петсто четрдесет седам")] - public void ToWordsSr(int number, string expected) { Assert.Equal(expected, number.ToWords()); } diff --git a/src/Humanizer.Tests/Localisation/sr/NumberToWordsTest.cs b/src/Humanizer.Tests/Localisation/sr/NumberToWordsTest.cs new file mode 100644 index 000000000..fb46c952c --- /dev/null +++ b/src/Humanizer.Tests/Localisation/sr/NumberToWordsTest.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using Xunit; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.sr +{ + public class NumberToWordsTest : AmbientCulture + { + public NumberToWordsTest() : base("sr") { } + + [Theory] + [InlineData(0, "нула")] + [InlineData(1, "један")] + [InlineData(2, "два")] + [InlineData(3, "три")] + [InlineData(4, "четири")] + [InlineData(5, "пет")] + [InlineData(6, "шест")] + [InlineData(7, "седам")] + [InlineData(8, "осам")] + [InlineData(9, "девет")] + [InlineData(10, "десет")] + [InlineData(20, "двадесет")] + [InlineData(30, "тридесет")] + [InlineData(40, "четрдесет")] + [InlineData(50, "петдесет")] + [InlineData(60, "шестдесет")] + [InlineData(70, "седамдесет")] + [InlineData(80, "осамдесет")] + [InlineData(90, "деветдесет")] + [InlineData(100, "сто")] + [InlineData(200, "двесто")] + [InlineData(1000, "хиљаду")] + [InlineData(10000, "десет хиљада")] + [InlineData(100000, "сто хиљада")] + [InlineData(1000000, "милион")] + [InlineData(10000000, "десет милиона")] + [InlineData(100000000, "сто милиона")] + [InlineData(1000000000, "милијарда")] + [InlineData(2000000000, "две милијарде")] + [InlineData(15, "петнаест")] + [InlineData(43, "четрдесет три")] + [InlineData(81, "осамдесет један")] + [InlineData(213, "двесто тринаест")] + [InlineData(547, "петсто четрдесет седам")] + public void ToWordsSr(int number, string expected) + { + Assert.Equal(expected, number.ToWords()); + } + } +} diff --git a/src/Humanizer/Configuration/NumberToWordsConverterRegistry.cs b/src/Humanizer/Configuration/NumberToWordsConverterRegistry.cs index 28d26a7e5..d660331d7 100644 --- a/src/Humanizer/Configuration/NumberToWordsConverterRegistry.cs +++ b/src/Humanizer/Configuration/NumberToWordsConverterRegistry.cs @@ -23,7 +23,8 @@ internal class NumberToWordsConverterRegistry : LocaliserRegistry new SerbianNumberToWordsConverter(culture)); + Register("sr", (culture) => new SerbianCyrlNumberToWordsConverter(culture)); + Register("sr-Latn", (culture) => new SerbianNumberToWordsConverter(culture)); } } } diff --git a/src/Humanizer/Humanizer.csproj b/src/Humanizer/Humanizer.csproj index c309c197e..0d507022b 100644 --- a/src/Humanizer/Humanizer.csproj +++ b/src/Humanizer/Humanizer.csproj @@ -74,6 +74,7 @@ + diff --git a/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs new file mode 100644 index 000000000..3e6f7f60a --- /dev/null +++ b/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; + +namespace Humanizer.Localisation.NumberToWords +{ + internal class SerbianCyrlNumberToWordsConverter : GenderlessNumberToWordsConverter + { + private static readonly string[] UnitsMap = { "нула", "један", "два", "три", "четири", "пет", "шест", "седам", "осам", "девет", "десет", "једанест", "дванаест", "тринаест", "четрнаест", "петнаест", "шестнаест", "седамнаест", "осамнаест", "деветнаест" }; + private static readonly string[] TensMap = { "нула", "десет", "двадесет", "тридесет", "четрдесет", "петдесет", "шестдесет", "седамдесет", "осамдесет", "деветдесет" }; + + private readonly CultureInfo _culture; + + public SerbianCyrlNumberToWordsConverter(CultureInfo culture) + { + _culture = culture; + } + + public override string Convert(int number) + { + if (number == 0) + { + return "нула"; + } + + if (number < 0) + { + return string.Format("- {0}", Convert(-number)); + } + + var parts = new List(); + var billions = number / 1000000000; + + if (billions > 0) + { + parts.Add(Part("милијарда", "две милијарде", "{0} милијарде", "{0} милијарда", billions)); + number %= 1000000000; + + if (number > 0) + { + parts.Add(" "); + } + } + + var millions = number / 1000000; + + if (millions > 0) + { + parts.Add(Part("милион", "два милиона", "{0} милиона", "{0} милиона", millions)); + number %= 1000000; + + if (number > 0) + { + parts.Add(" "); + } + } + + var thousands = number / 1000; + + if (thousands > 0) + { + parts.Add(Part("хиљаду", "две хиљаде", "{0} хиљаде", "{0} хиљада", thousands)); + number %= 1000; + + if (number > 0) + { + parts.Add(" "); + } + } + + var hundreds = number / 100; + + if (hundreds > 0) + { + + parts.Add(Part("сто", "двесто", "{0}сто", "{0}сто", hundreds)); + number %= 100; + + if (number > 0) + { + parts.Add(" "); + } + } + + if (number > 0) + { + if (number < 20) + { + parts.Add(UnitsMap[number]); + } + else + { + parts.Add(TensMap[number / 10]); + + var units = number % 10; + + if (units > 0) + { + parts.Add(string.Format(" {0}", UnitsMap[units])); + } + } + } + + return string.Join("", parts); + } + + public override string ConvertToOrdinal(int number) + { + //TODO: In progress + return number.ToString(_culture); + } + + private string Part(string singular, string dual, string trialQuadral, string plural, int number) + { + switch (number) + { + case 1: + return singular; + case 2: + return dual; + case 3: + case 4: + return string.Format(trialQuadral, Convert(number)); + default: + return string.Format(plural, Convert(number)); + } + } + } +} diff --git a/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs index 104869d88..3dcf77193 100644 --- a/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs @@ -8,43 +8,21 @@ namespace Humanizer.Localisation.NumberToWords { internal class SerbianNumberToWordsConverter : GenderlessNumberToWordsConverter { - private static readonly string SR_NAME = "sr"; - private static readonly string SR_LATN_NAME = "sr-Latn"; - - private static string[] UnitsMap = new string[1]; - private static string[] TensMap = new string[1]; - - private static readonly string[] UnitsMapSr = { "нула", "један", "два", "три", "четири", "пет", "шест", "седам", "осам", "девет", "десет", "једанест", "дванаест", "тринаест", "четрнаест", "петнаест", "шестнаест", "седамнаест", "осамнаест", "деветнаест" }; - private static readonly string[] TensMapSr = { "нула", "десет", "двадесет", "тридесет", "четрдесет", "петдесет", "шестдесет", "седамдесет", "осамдесет", "деветдесет" }; - - private static readonly string[] UnitsMapLatn = { "nula", "jedan", "dva", "tri", "četiri", "pet", "šest", "sedam", "osam", "devet", "deset", "jedanaest", "dvanaest", "trinaest", "četrnaestt", "petnaest", "šestnaest", "sedemnaest", "osemnaest", "devetnaest" }; - private static readonly string[] TensMapLatn = { "nula", "deset", "dvadeset", "trideset", "četrdeset", "petdeset", "šestdeset", "sedamdeset", "osamdeset", "devetdeset" }; + private static readonly string[] UnitsMap = { "nula", "jedan", "dva", "tri", "četiri", "pet", "šest", "sedam", "osam", "devet", "deset", "jedanaest", "dvanaest", "trinaest", "četrnaestt", "petnaest", "šestnaest", "sedemnaest", "osemnaest", "devetnaest" }; + private static readonly string[] TensMap = { "nula", "deset", "dvadeset", "trideset", "četrdeset", "petdeset", "šestdeset", "sedamdeset", "osamdeset", "devetdeset" }; private readonly CultureInfo _culture; public SerbianNumberToWordsConverter(CultureInfo culture) { _culture = culture; - - if (_culture != null && _culture.Name.Equals(SR_LATN_NAME)) - { - UnitsMap = UnitsMapLatn; - TensMap = TensMapLatn; - } - else - { - UnitsMap = UnitsMapSr; - TensMap = TensMapSr; - } } public override string Convert(int number) { - bool isLatn = (_culture != null &&_culture.Name == SR_LATN_NAME); - if (number == 0) { - return (isLatn) ? "nula" : "нула"; + return "nula"; } if (number < 0) @@ -57,15 +35,7 @@ public override string Convert(int number) if (billions > 0) { - if (isLatn) - { - parts.Add(Part("milijarda", "dve milijarde", "{0} milijarde", "{0} milijarda", billions)); - } - else - { - parts.Add(Part("милијарда", "две милијарде", "{0} милијарде", "{0} милијарда", billions)); - } - + parts.Add(Part("milijarda", "dve milijarde", "{0} milijarde", "{0} milijarda", billions)); number %= 1000000000; if (number > 0) @@ -78,15 +48,7 @@ public override string Convert(int number) if (millions > 0) { - if (isLatn) - { - parts.Add(Part("milion", "dva miliona", "{0} miliona", "{0} miliona", millions)); - } - else - { - parts.Add(Part("милион", "два милиона", "{0} милиона", "{0} милиона", millions)); - } - + parts.Add(Part("milion", "dva miliona", "{0} miliona", "{0} miliona", millions)); number %= 1000000; if (number > 0) @@ -99,15 +61,7 @@ public override string Convert(int number) if (thousands > 0) { - if (isLatn) - { - parts.Add(Part("hiljadu", "dve hiljade", "{0} hiljade", "{0} hiljada", thousands)); - } - else - { - parts.Add(Part("хиљаду", "две хиљаде", "{0} хиљаде", "{0} хиљада", thousands)); - } - + parts.Add(Part("hiljadu", "dve hiljade", "{0} hiljade", "{0} hiljada", thousands)); number %= 1000; if (number > 0) @@ -120,14 +74,7 @@ public override string Convert(int number) if (hundreds > 0) { - if (isLatn) - { - parts.Add(Part("sto", "dvesto", "{0}sto", "{0}sto", hundreds)); - } - else - { - parts.Add(Part("сто", "двесто", "{0}сто", "{0}сто", hundreds)); - } + parts.Add(Part("sto", "dvesto", "{0}sto", "{0}sto", hundreds)); number %= 100; if (number > 0)