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

This commit is contained in:
Jean Chevronnet 2026-07-20 02:03:05 +00:00
parent 74a58c5425
commit ecdead8278
No known key found for this signature in database
34 changed files with 572 additions and 186 deletions

View file

@ -39,7 +39,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, net:
}
let ajoin = db.ajoin_list(&acct.name);
if !ajoin.is_empty() {
ctx.notice(me, from.uid, t!(ctx, " Auto-join : {count} channel(s) — see \x02AJOIN LIST\x02", count = ajoin.len()));
ctx.notice(me, from.uid, echo_api::plural!(ctx, ajoin.len(), one = " Auto-join : {count} channel — see \x02AJOIN LIST\x02", other = " Auto-join : {count} channels — see \x02AJOIN LIST\x02", count = ajoin.len()));
}
}
// A staff note is for operators' eyes only, never the account's owner.

View file

@ -20,5 +20,5 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
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 { 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));
ctx.notice(me, from.uid, echo_api::plural!(ctx, matches.len(), one = "End of list — {count} match{more}.", other = "End of list — {count} matches{more}.", count = matches.len(), more = more));
}

View file

@ -1,5 +1,4 @@
use echo_api::{Sender, ServiceCtx, Store};
use echo_api::t;
// UPDATE: re-apply your account's auto-joins and vhost, and re-check for waiting
// memos, without having to re-identify.
@ -16,7 +15,7 @@ pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &dyn Store) {
}
let unread = db.unread_memos(account);
if unread > 0 {
ctx.notice(me, from.uid, t!(ctx, "You have \x02{unread}\x02 new memo(s). Read them with \x02/msg MemoServ READ NEW\x02.", unread = unread));
ctx.notice(me, from.uid, echo_api::plural!(ctx, unread, one = "You have \x02{unread}\x02 new memo. Read it with \x02/msg MemoServ READ NEW\x02.", other = "You have \x02{unread}\x02 new memos. Read them with \x02/msg MemoServ READ NEW\x02.", unread = unread));
}
ctx.notice(me, from.uid, "Your status has been refreshed.");
}