aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-08-17 04:40:08 -0400
committerJesse Luehrs <doy@tozt.net>2019-08-17 04:40:08 -0400
commit1de9de382be27e3f7ddf679b0b0521fd258345bf (patch)
treeb97dc8cdb2b71587a74da8b75689448d75d41efa
parentf5a1913b2b1b471d1b816db34b1c6d2da4970c73 (diff)
downloadynab-reimbursements-1de9de382be27e3f7ddf679b0b0521fd258345bf.tar.gz
ynab-reimbursements-1de9de382be27e3f7ddf679b0b0521fd258345bf.zip
plural handling
-rw-r--r--src/views/txn_table.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/views/txn_table.rs b/src/views/txn_table.rs
index a2ec3f7..26b4462 100644
--- a/src/views/txn_table.rs
+++ b/src/views/txn_table.rs
@@ -284,9 +284,10 @@ pub fn txn_tables(budget: &crate::ynab::Budget) -> impl cursive::view::View {
let mut inflows_table = inflows_table(&budget);
layout.add_child(cursive::views::TextView::new(format!(
- "Inflows: {} ({} transactions)",
+ "Inflows: {} ({} transaction{}",
crate::ynab::format_amount(inflows_table.amount()),
- inflows_table.len()
+ inflows_table.len(),
+ if inflows_table.len() == 1 { ") " } else { "s)" }
)));
layout.add_child(cursive::views::CircularFocus::wrap_arrows(
cursive::views::BoxView::with_min_height(
@@ -299,9 +300,14 @@ pub fn txn_tables(budget: &crate::ynab::Budget) -> impl cursive::view::View {
let mut outflows_table = outflows_table(&budget);
layout.add_child(cursive::views::TextView::new(format!(
- "Outflows: {} ({} transactions)",
+ "Outflows: {} ({} transaction{}",
crate::ynab::format_amount(outflows_table.amount()),
- outflows_table.len()
+ outflows_table.len(),
+ if outflows_table.len() == 1 {
+ ") "
+ } else {
+ "s)"
+ }
)));
layout.add_child(cursive::views::CircularFocus::wrap_arrows(
cursive::views::BoxView::with_full_screen(outflows_table),