i18n: per-network locale (en/es/fr) for karma replies and the web board
All checks were successful
ci / check (push) Successful in 45s

This commit is contained in:
Jean Chevronnet 2026-07-30 00:31:17 +00:00
parent f290554325
commit 739fc8ad94
No known key found for this signature in database
GPG key ID: 439666D63A9477E4
11 changed files with 406 additions and 115 deletions

View file

@ -90,7 +90,7 @@ over TLS.
```sh
cargo build --release --bin karma-web
./target/release/karma-web <data-dir> <out.html> # omit out.html to print to stdout
./target/release/karma-web <data-dir> <out.html> [locale] # locale: en|es|fr (default en)
```
On mars: `karma-web.service` + `karma-web.timer` write `/var/www/karma/index.html`,
@ -123,8 +123,24 @@ RUSTBOT_CONFIG=/etc/rustbot.conf cargo run
Config file keys: `server`, `port`, `tls`, `nick`, `user`, `realname`,
`channels` (comma/space-separated), `prefix`, `verbose` (wire logging, default
on), `password`, `sasl_user`, `sasl_pass`, and `name` (a network's log label).
Whole-line `#`/`;` comments only — inline comments would clash with channel `#`s.
on), `password`, `sasl_user`, `sasl_pass`, `name` (a network's log label), and
`locale` (`en`/`es`/`fr`, default `en`). Whole-line `#`/`;` comments only —
inline comments would clash with channel `#`s.
### Locales
`locale` sets a network's language, so a community sees the bot in its own
tongue — e.g. `#argentina` on libera runs in Spanish. It currently drives the
`karma` module's replies and milestone announcements (English, Spanish, French);
other modules fall back to English. The web board takes its own locale as
`karma-web`'s third argument (or `RUSTBOT_LOCALE`), so the page can match the
audience.
```ini
[libera]
channels = #argentina
locale = es # karma replies + milestones in Spanish
```
Web modules write per-network state under `RUSTBOT_DATA_DIR` (default `.`).