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

@ -9,7 +9,7 @@ pub fn handle(me: &str, from: &Sender, account: &str, args: &[&str], ctx: &mut S
for i in (0..count).rev() {
db.memo_del(account, i);
}
ctx.notice(me, from.uid, t!(ctx, "Deleted all \x02{count}\x02 memo(s).", count = count));
ctx.notice(me, from.uid, echo_api::plural!(ctx, count, one = "Deleted all \x02{count}\x02 memo.", other = "Deleted all \x02{count}\x02 memos.", count = count));
}
Some(numstr) => {
let Some(n) = numstr.parse::<usize>().ok().filter(|n| *n >= 1) else {

View file

@ -1,4 +1,4 @@
use echo_api::{t, Sender, ServiceCtx, Store};
use echo_api::{Sender, ServiceCtx, Store};
// INFO: a summary of your mailbox (total, unread, capacity).
pub fn handle(me: &str, from: &Sender, account: &str, ctx: &mut ServiceCtx, db: &mut dyn Store) {
@ -7,6 +7,6 @@ pub fn handle(me: &str, from: &Sender, account: &str, ctx: &mut ServiceCtx, db:
ctx.notice(
me,
from.uid,
t!(ctx, "You have \x02{total}\x02 memo(s), \x02{unread}\x02 unread, of a maximum \x02{max}\x02.", total = total, unread = unread, max = super::MAX_MEMOS),
echo_api::plural!(ctx, total, one = "You have \x02{total}\x02 memo, \x02{unread}\x02 unread, of a maximum \x02{max}\x02.", other = "You have \x02{total}\x02 memos, \x02{unread}\x02 unread, of a maximum \x02{max}\x02.", total = total, unread = unread, max = super::MAX_MEMOS),
);
}

View file

@ -1,4 +1,4 @@
use echo_api::{t, Priv, Sender, ServiceCtx, Store};
use echo_api::{Priv, Sender, ServiceCtx, Store};
// SENDALL <text>: leave a memo on every registered account. Admin-only, for
// network-wide announcements that persist until read.
@ -20,5 +20,5 @@ pub fn handle(me: &str, from: &Sender, account: &str, args: &[&str], ctx: &mut S
sent += 1;
}
}
ctx.notice(me, from.uid, t!(ctx, "Memo sent to \x02{sent}\x02 account(s).", sent = sent));
ctx.notice(me, from.uid, echo_api::plural!(ctx, sent, one = "Memo sent to \x02{sent}\x02 account.", other = "Memo sent to \x02{sent}\x02 accounts.", sent = sent));
}

View file

@ -1,4 +1,4 @@
use echo_api::{t, NetView, Priv, Sender, ServiceCtx, Store};
use echo_api::{NetView, Priv, Sender, ServiceCtx, Store};
// STAFF <text>: leave a memo on every operator's account. Admin-only, for
// notes to the staff team that persist until read. Recipients are the union of
@ -29,5 +29,5 @@ pub fn handle(me: &str, from: &Sender, account: &str, args: &[&str], ctx: &mut S
sent += 1;
}
}
ctx.notice(me, from.uid, t!(ctx, "Memo sent to \x02{sent}\x02 operator(s).", sent = sent));
ctx.notice(me, from.uid, echo_api::plural!(ctx, sent, one = "Memo sent to \x02{sent}\x02 operator.", other = "Memo sent to \x02{sent}\x02 operators.", sent = sent));
}