Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant parameter #1433

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class BulgarianNumberToWordsConverter : GenderedNumberToWordsConverter
];

public override string Convert(long input, GrammaticalGender gender, bool addAnd = true) =>
Convert(input, gender, false);
InnerConvert(input, gender, false);

static string Convert(long input, GrammaticalGender gender, bool isOrdinal, bool addAnd = true)
static string InnerConvert(long input, GrammaticalGender gender, bool isOrdinal)
{
if (input is > int.MaxValue or < int.MinValue)
{
Expand All @@ -61,20 +61,20 @@ static string Convert(long input, GrammaticalGender gender, bool isOrdinal, bool

if (input / 1000000000 > 0)
{
parts.Add(input < 2000000000 ? "един милиард" : Convert(input / 1000000000, gender, false) + " милиарда");
parts.Add(input < 2000000000 ? "един милиард" : InnerConvert(input / 1000000000, gender, false) + " милиарда");

if (isOrdinal)
lastOrdinalSubstitution = Convert(input / 1000000000, gender, false) + " милиард" +
lastOrdinalSubstitution = InnerConvert(input / 1000000000, gender, false) + " милиард" +
GetEndingForGender(gender, input);
input %= 1000000000;
}

if (input / 1000000 > 0)
{
parts.Add(input < 2000000 ? "един милион" : Convert(input / 1000000, gender, false) + " милиона");
parts.Add(input < 2000000 ? "един милион" : InnerConvert(input / 1000000, gender, false) + " милиона");

if (isOrdinal)
lastOrdinalSubstitution = Convert(input / 1000000, gender, false) + " милион" +
lastOrdinalSubstitution = InnerConvert(input / 1000000, gender, false) + " милион" +
GetEndingForGender(gender, input);

input %= 1000000;
Expand All @@ -86,11 +86,11 @@ static string Convert(long input, GrammaticalGender gender, bool isOrdinal, bool
parts.Add("хиляда");
else
{
parts.Add(Convert(input / 1000, gender, false) + " хиляди");
parts.Add(InnerConvert(input / 1000, gender, false) + " хиляди");
}

if (isOrdinal)
lastOrdinalSubstitution = Convert(input / 1000, gender, false) + " хиляд" +
lastOrdinalSubstitution = InnerConvert(input / 1000, gender, false) + " хиляд" +
GetEndingForGender(gender, input);

input %= 1000;
Expand Down Expand Up @@ -136,7 +136,7 @@ static string Convert(long input, GrammaticalGender gender, bool isOrdinal, bool
}

public override string ConvertToOrdinal(int input, GrammaticalGender gender) =>
Convert(input, gender, true);
InnerConvert(input, gender, true);

static string GetEndingForGender(GrammaticalGender gender, long input)
{
Expand Down