From 6f8ff39f99af601c62d2d153774f366107a7f05c Mon Sep 17 00:00:00 2001 From: reverse Date: Tue, 25 Aug 2026 12:18:17 +0000 Subject: [PATCH] i18n: localize the welcome burst (001-003/251) via trf() dynamic templates (fr, es) --- lang/es.conf | 6 ++++++ lang/fr.conf | 6 ++++++ src/users.rs | 32 ++++++++++++-------------------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/lang/es.conf b/lang/es.conf index 5884857..a9854fc 100644 --- a/lang/es.conf +++ b/lang/es.conf @@ -4,6 +4,12 @@ # nombres de comandos, letras de modo) se mantienen. Una entrada ausente # recae en el inglés. +# --- bienvenida (001-004): prosa dinámica, plantillas {0}/{1} --- +"Welcome to the {0} IRC Network, {1}" = "Bienvenido a la red IRC {0}, {1}" +"Your host is {0}, running echoircd-{1}" = "Tu host es {0}, ejecutando echoircd-{1}" +"This server was created at unix {0}" = "Este servidor fue creado el (unix) {0}" +"There are {0} users on 1 server" = "Hay {0} usuarios en 1 servidor" + # --- avisos / desafíos --- "*** Cloudflare Challenge: verification successful — you may continue." = "*** Desafío de Cloudflare: verificación exitosa — puedes continuar." "*** Correct — you may now message freely; please resend your message." = "*** Correcto — ya puedes enviar mensajes libremente; por favor reenvía tu mensaje." diff --git a/lang/fr.conf b/lang/fr.conf index ff8b51d..4111f0d 100644 --- a/lang/fr.conf +++ b/lang/fr.conf @@ -4,6 +4,12 @@ # noms de commandes, lettres de mode) restent tels quels. Une entrée absente # retombe sur l'anglais. +# --- accueil (001-004) : prose dynamique, gabarits {0}/{1} --- +"Welcome to the {0} IRC Network, {1}" = "Bienvenue sur le réseau IRC {0}, {1}" +"Your host is {0}, running echoircd-{1}" = "Votre hôte est {0}, sous echoircd-{1}" +"This server was created at unix {0}" = "Ce serveur a été créé le (unix) {0}" +"There are {0} users on 1 server" = "Il y a {0} utilisateurs sur 1 serveur" + # --- notices / défis --- "*** Cloudflare Challenge: verification successful — you may continue." = "*** Défi Cloudflare : vérification réussie — vous pouvez continuer." "*** Correct — you may now message freely; please resend your message." = "*** Correct — vous pouvez maintenant envoyer des messages librement ; veuillez renvoyer votre message." diff --git a/src/users.rs b/src/users.rs index 9483c7f..bd66f46 100644 --- a/src/users.rs +++ b/src/users.rs @@ -460,21 +460,15 @@ impl Server { .get(&uid) .map(|u| u.nick.clone()) .unwrap_or_default(); - self.numeric( - uid, - RPL_WELCOME, - &format!(":Welcome to the {} IRC Network, {nick}", self.disp_network(uid)), - ); - self.numeric( - uid, - RPL_YOURHOST, - &format!(":Your host is {}, running echoircd-{RELEASE}", self.disp_name(uid)), - ); - self.numeric( - uid, - RPL_CREATED, - &format!(":This server was created at unix {}", self.created), - ); + let net = self.disp_network(uid).to_string(); + let welcome = self.trf("Welcome to the {0} IRC Network, {1}", &[net.as_str(), nick.as_str()]); + self.numeric(uid, RPL_WELCOME, &format!(":{welcome}")); + let host = self.disp_name(uid).to_string(); + let yourhost = self.trf("Your host is {0}, running echoircd-{1}", &[host.as_str(), RELEASE]); + self.numeric(uid, RPL_YOURHOST, &format!(":{yourhost}")); + let created = self.created.to_string(); + let created_msg = self.trf("This server was created at unix {0}", &[created.as_str()]); + self.numeric(uid, RPL_CREATED, &format!(":{created_msg}")); self.numeric( uid, RPL_MYINFO, @@ -491,11 +485,9 @@ impl Server { .map(|u| u.caps.ext_isupport && u.caps.batch) .unwrap_or(false); self.send_isupport(uid, batched); - self.numeric( - uid, - RPL_LUSERCLIENT, - &format!(":There are {} users on 1 server", self.users.len()), - ); + let count = self.users.len().to_string(); + let lusers = self.trf("There are {0} users on 1 server", &[count.as_str()]); + self.numeric(uid, RPL_LUSERCLIENT, &format!(":{lusers}")); self.send_motd(uid); // connbanner: NOTICE lines to every connecting client for line in self.conf_all("connbanner").to_vec() {