Handle plurals properly
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -289,12 +289,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
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)
{
@@ -335,6 +335,16 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SetAmountIfMax();
}
+ private static string IfPlural(int val, string singular, string plural)
+ {
+ if (val == 1)
+ {
+ return singular;
+ }
+
+ return plural;
+ }
+
private void SetAmountIfMax()
{
IgnoreAmountChanges = true;

Handle plurals properly