Migrate interpolated service messages to the t! macro (8 modules)

This commit is contained in:
Jean Chevronnet 2026-07-19 23:22:56 +00:00
parent b462d37bd5
commit d207c3d60d
No known key found for this signature in database
133 changed files with 782 additions and 702 deletions

View file

@ -1,4 +1,5 @@
use echo_api::{human_time, Priv, Sender, ServiceCtx, Store};
use echo_api::t;
// A cap so a broad glob can't flood the requesting oper.
const MAX_SHOWN: usize = 100;
@ -13,11 +14,11 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
let mut matches = db.accounts_matching(pattern);
matches.sort_by_key(|a| a.name.to_ascii_lowercase());
ctx.notice(me, from.uid, format!("Accounts matching \x02{pattern}\x02:"));
ctx.notice(me, from.uid, t!(ctx, "Accounts matching \x02{pattern}\x02:", pattern = pattern));
for a in matches.iter().take(MAX_SHOWN) {
let flag = if a.verified { "" } else { " (unconfirmed)" };
ctx.notice(me, from.uid, format!(" \x02{}\x02 registered {}{}", a.name, human_time(a.ts), flag));
ctx.notice(me, from.uid, t!(ctx, " \x02{name}\x02 registered {when}{flag}", name = a.name, when = human_time(a.ts), flag = flag));
}
let more = if matches.len() > MAX_SHOWN { format!(", showing the first {MAX_SHOWN}") } else { String::new() };
ctx.notice(me, from.uid, format!("End of list — {} match(es){more}.", matches.len()));
let more = if matches.len() > MAX_SHOWN { t!(ctx, ", showing the first {max}", max = MAX_SHOWN) } else { String::new() };
ctx.notice(me, from.uid, t!(ctx, "End of list — {count} match(es){more}.", count = matches.len(), more = more));
}