Skip to content

Commit

Permalink
Handle plurals properly
Browse files Browse the repository at this point in the history
  • Loading branch information
nopara73 committed Dec 21, 2018
1 parent a49491a commit 428937f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ private void SetFeesAndTexts()
else if (feeTarget >= 7 && feeTarget <= 144) // hours
{
var h = feeTarget / 6;
ConfirmationExpectedText = $"{h} hours";
ConfirmationExpectedText = $"{h} {IfPlural(h, "hour", "hours")}";
}
else if (feeTarget >= 145 && feeTarget < 1008) // days
{
var d = feeTarget / 144;
ConfirmationExpectedText = $"{d} days";
ConfirmationExpectedText = $"{d} {IfPlural(d, "day", "days")}";
}
else if (feeTarget == 10008)
{
Expand Down Expand Up @@ -335,6 +335,16 @@ private void SetFeesAndTexts()
SetAmountIfMax();
}

private static string IfPlural(int val, string singular, string plural)
{
if (val == 1)
{
return singular;
}

return plural;
}

private void SetAmountIfMax()
{
IgnoreAmountChanges = true;
Expand Down Expand Up @@ -546,8 +556,8 @@ public string Amount
public int FeeTarget
{
get => _feeTarget;
set
{
set
{
this.RaiseAndSetIfChanged(ref _feeTarget, value);
Global.UiConfig.FeeTarget = value;
}
Expand Down

0 comments on commit 428937f

Please sign in to comment.