Add lightweight i18n foundation; route new strings through catalogs

- Backend src/i18n.rs: embedded locales/<lang>.json, t(key,params) with {placeholder} interpolation, process-wide language from config.language (default it), English-then-key fallback. Applied to the identity reminder and name-lock/empty errors.

- Frontend: web/assets/locales/<lang>.json + t()/loadI18n()/applyI18n() (data-i18n attributes); language follows the browser; async bootstrap. Applied to the settings panel.

- Convention: new user-facing and model-facing strings use the catalog; wire/JSON/identifiers never translated. Existing strings migrate in a later round. it+en catalogs; 115 tests; verified live (catalog error messages) + node --check + HTTP. README documents the convention.
This commit is contained in:
adm committed 2026-11-25 16:05:29 +01:00
1 parent 73b665d1a7
commit 498e3dbc1b
12 files changed
+248 -27

No files matched your search

+9
View File
@@ -88,6 +88,10 @@ pub struct Config {
#[serde(default)]
pub workspace_root: Option<String>,
/// UI / model-prompt language (catalog key, e.g. "it", "en"). Defaults to Italian.
#[serde(default)]
pub language: Option<String>,
/// Startup (wait for `READY`) and silence-watchdog timeouts, in seconds.
/// Optional: both default to 600s when absent.
#[serde(default)]
@@ -238,6 +242,11 @@ impl Config {
PathBuf::from(home).join(".strata-ctl")
}
/// Effective language: config > `it`.
pub fn language(&self) -> String {
self.language.clone().unwrap_or_else(|| "it".to_string())
}
/// The top-level keys present in the file that we are not acting on —
/// reported by `--check` so the shared-file contract stays visible.
pub fn ignored_keys(&self) -> Vec<&str> {