Localize service-module messages via t! and add French translations (partial)

This commit is contained in:
Jean Chevronnet 2026-07-19 23:24:54 +00:00
parent d207c3d60d
commit b28bd2777f
No known key found for this signature in database
5 changed files with 408 additions and 29 deletions

View file

@ -1,4 +1,4 @@
use echo_api::{NetView, Sender, ServiceCtx};
use echo_api::{t, NetView, Sender, ServiceCtx};
// SCORES <#channel>: show the op-time standings ChanFix would reop from.
pub fn handle(me: &str, from: &Sender, chan: Option<&str>, ctx: &mut ServiceCtx, net: &dyn NetView) {
@ -8,11 +8,11 @@ pub fn handle(me: &str, from: &Sender, chan: Option<&str>, ctx: &mut ServiceCtx,
};
let scores = net.chanfix_scores(chan);
if scores.is_empty() {
ctx.notice(me, from.uid, format!("No op-time recorded for \x02{chan}\x02 yet."));
ctx.notice(me, from.uid, t!(ctx, "No op-time recorded for \x02{chan}\x02 yet.", chan = chan));
return;
}
for (id, score) in scores.iter().take(15) {
ctx.notice(me, from.uid, format!(" \x02{score}\x02 {id}"));
ctx.notice(me, from.uid, t!(ctx, " \x02{score}\x02 {id}", score = score, id = id));
}
ctx.notice(me, from.uid, format!("Top {} of {} scored identit{} for \x02{chan}\x02.", scores.len().min(15), scores.len(), if scores.len() == 1 { "y" } else { "ies" }));
ctx.notice(me, from.uid, t!(ctx, "Top {shown} of {total} scored identit{suffix} for \x02{chan}\x02.", shown = scores.len().min(15), total = scores.len(), suffix = if scores.len() == 1 { "y" } else { "ies" }, chan = chan));
}