Pluralize count-dependent messages with a CLDR one/other selector and gate catalog consistency with a test
All checks were successful
CI / check (push) Successful in 5m20s
All checks were successful
CI / check (push) Successful in 5m20s
This commit is contained in:
parent
74a58c5425
commit
ecdead8278
34 changed files with 572 additions and 186 deletions
|
|
@ -34,5 +34,5 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, net:
|
|||
banned += 1;
|
||||
}
|
||||
}
|
||||
ctx.notice(me, from.uid, t!(ctx, "CHANKILL on \x02{chan}\x02: \x02{banned}\x02 host(s) AKILL'd.", chan = chan, banned = banned));
|
||||
ctx.notice(me, from.uid, echo_api::plural!(ctx, banned, one = "CHANKILL on \x02{chan}\x02: \x02{banned}\x02 host AKILL'd.", other = "CHANKILL on \x02{chan}\x02: \x02{banned}\x02 hosts AKILL'd.", chan = chan, banned = banned));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
|||
Some("VIEW") => list(me, from, true, args.get(2).copied(), ctx, db),
|
||||
Some("CLEAR") => match db.notify_clear() {
|
||||
Ok(0) => ctx.notice(me, from.uid, "The notify list is already empty."),
|
||||
Ok(n) => ctx.notice(me, from.uid, t!(ctx, "Cleared \x02{n}\x02 notify watch(es).", n = n)),
|
||||
Ok(n) => ctx.notice(me, from.uid, echo_api::plural!(ctx, n, one = "Cleared \x02{n}\x02 notify watch.", other = "Cleared \x02{n}\x02 notify watches.", n = n)),
|
||||
Err(_) => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."),
|
||||
},
|
||||
_ => ctx.notice(me, from.uid, SYNTAX),
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ pub fn handle_session(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceC
|
|||
for (ip, n) in &over {
|
||||
ctx.notice(me, from.uid, t!(ctx, " \x02{n}\x02 sessions from \x02{ip}\x02", n = n, ip = ip));
|
||||
}
|
||||
ctx.notice(me, from.uid, t!(ctx, "End of session list ({count} IP(s)).", count = over.len()));
|
||||
ctx.notice(me, from.uid, echo_api::plural!(ctx, over.len(), one = "End of session list ({count} IP).", other = "End of session list ({count} IPs).", count = over.len()));
|
||||
}
|
||||
Some("VIEW") => {
|
||||
let Some(&ip) = args.get(2) else {
|
||||
ctx.notice(me, from.uid, "Syntax: SESSION VIEW <ip>");
|
||||
return;
|
||||
};
|
||||
ctx.notice(me, from.uid, t!(ctx, "\x02{ip}\x02 has \x02{count}\x02 live session(s).", ip = ip, count = net.session_count(ip)));
|
||||
ctx.notice(me, from.uid, echo_api::plural!(ctx, net.session_count(ip), one = "\x02{ip}\x02 has \x02{count}\x02 live session.", other = "\x02{ip}\x02 has \x02{count}\x02 live sessions.", ip = ip, count = net.session_count(ip)));
|
||||
}
|
||||
_ => ctx.notice(me, from.uid, "Syntax: SESSION LIST <min> | SESSION VIEW <ip>"),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue