Add i18n framework: per-account language, catalogs, t! macro, SET LANGUAGE
All checks were successful
CI / check (push) Successful in 5m16s

This commit is contained in:
Jean Chevronnet 2026-07-19 22:57:45 +00:00
parent 83851c794d
commit b462d37bd5
No known key found for this signature in database
16 changed files with 272 additions and 12 deletions

View file

@ -112,6 +112,9 @@ pub struct Account {
// pseudoclient. Default (normal notice) is the zero value.
#[serde(default)]
pub snotice: bool,
// NickServ SET LANGUAGE: preferred reply language (None = the network default).
#[serde(default)]
pub language: Option<String>,
// Assigned vhost (HostServ), applied to the displayed host on identify.
#[serde(default)]
pub vhost: Option<Vhost>,
@ -1166,6 +1169,8 @@ pub struct Db {
// against accounts pushed in (via the gRPC Accounts API). Node-local config.
external_accounts: bool,
confusable_check: bool, // reject look-alike / mixed-script REGISTER names
default_language: String, // network-wide reply language for users with no preference
available_languages: Vec<String>, // language codes a user may pick with SET LANGUAGE
}
// A juped server: the held name, the fake server id we allocated for it, and why.
@ -1234,7 +1239,7 @@ impl Db {
apply(&mut accounts, &mut channels, &mut grouped, &mut bots, &mut host_cfg, &mut net, event);
}
tracing::info!(accounts = accounts.len(), channels = channels.len(), "account store loaded");
Self { accounts, channels, grouped, log, extban_enabled: None, notify_exclude: Vec::new(), live_extbans: None, live_chanmodes: None, scram_iterations: scram::DEFAULT_ITERATIONS, email_enabled: false, email_brand: "Network Services".to_string(), email_accent: "#4f46e5".to_string(), email_logo: String::new(), codes: HashMap::new(), auth_fails: HashMap::new(), vhost_req_times: HashMap::new(), report_times: HashMap::new(), bots, host_cfg, net, ignores: Vec::new(), defcon: 5, external_accounts: false, confusable_check: true }
Self { accounts, channels, grouped, log, extban_enabled: None, notify_exclude: Vec::new(), live_extbans: None, live_chanmodes: None, scram_iterations: scram::DEFAULT_ITERATIONS, email_enabled: false, email_brand: "Network Services".to_string(), email_accent: "#4f46e5".to_string(), email_logo: String::new(), codes: HashMap::new(), auth_fails: HashMap::new(), vhost_req_times: HashMap::new(), report_times: HashMap::new(), bots, host_cfg, net, ignores: Vec::new(), defcon: 5, external_accounts: false, confusable_check: true, default_language: "en".to_string(), available_languages: vec!["en".to_string()] }
}
/// Fold an entry authored by another node into the store — the services-side