From fa715c8c94696c4f15d4522d5d725e3c78fd94b8 Mon Sep 17 00:00:00 2001 From: skybluu <12523559+skybluu@users.noreply.github.com> Date: Mon, 12 Oct 2026 22:36:38 -0500 Subject: [PATCH 1/2] Localize Info Overlay mode notices (#911) --- README.md | 2 +- README.zh-hans.md | 2 +- crates/ui-egui/src/headless.rs | 34 ++++++++++++++++++++++++++++++++++ crates/ui-egui/src/menus.rs | 2 +- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 53ec908de..4dba64bec 100644 --- a/README.md +++ b/README.md @@ -427,7 +427,7 @@ Without it LightCraft builds and runs the same, but Chinese and Japanese text ha repo — the standard for what goes there lives with it: see the [craft-fonts README](https://github.com/storytold/craft-fonts#readme). **Interface language:** **Edit → Language** (English, 简体中文, 繁體中文(台灣), 日本語, Português (Brasil), Español, Deutsch, Русский, Français, Українська, Čeština, ქართული) or **Settings → General → -Language**; the choice applies immediately and persists. See [docs/localization.md](docs/localization.md). +Language**; the choice applies immediately and persists. Info Overlay mode-change toasts use the selected interface language. See [docs/localization.md](docs/localization.md). **Logs:** the desktop app writes its log to standard error and to `logs/lightcraft.log` in its settings folder (Linux `$XDG_CONFIG_HOME/lightcraft/logs/`, by default `~/.config/lightcraft/logs/`; macOS diff --git a/README.zh-hans.md b/README.zh-hans.md index f2d155214..fc9373445 100644 --- a/README.zh-hans.md +++ b/README.zh-hans.md @@ -394,7 +394,7 @@ CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p lightcraft 本仓库;见 [craftrules `standards/fonts.md`](https://github.com/storytold/craftrules/blob/main/standards/fonts.md)。 **界面语言:** **编辑 → 语言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français)或 **设置 → 一般 → -语言**;选择立即生效并会保留。见 [docs/localization.md](docs/localization.md)。 +语言**;选择立即生效并会保留。信息叠加模式切换提示使用所选界面语言。见 [docs/localization.md](docs/localization.md)。 **日志:** 桌面应用把日志写到标准错误,以及设置文件夹里的 `logs/lightcraft.log` (Linux `$XDG_CONFIG_HOME/lightcraft/logs/`,默认 `~/.config/lightcraft/logs/`;macOS diff --git a/crates/ui-egui/src/headless.rs b/crates/ui-egui/src/headless.rs index 6178990b0..e0888c9bb 100644 --- a/crates/ui-egui/src/headless.rs +++ b/crates/ui-egui/src/headless.rs @@ -4292,6 +4292,40 @@ mod tests { h.settle(SETTLE); } + /// #911 (toast labels only): cycling the overlay announces each mode in the UI language. + #[test] + fn info_overlay_toasts_are_painted_in_the_users_language() { + use crate::i18n::Locale; + + struct RestoreLanguage(Locale); + impl Drop for RestoreLanguage { + fn drop(&mut self) { + crate::i18n::set_language(self.0); + } + } + let _restore = RestoreLanguage(crate::i18n::language()); + let mut h = demo([1000.0, 700.0]); + let t = Duration::from_secs(10); + assert_eq!(h.request("ui.set", json!({"view": "detail", "infoOverlay": "off"}), t)["ok"], true); + for (command, locale) in [("app.language.german", Locale::De), ("app.language.french", Locale::Fr), ("app.language.english", Locale::En)] { + assert_eq!(h.request("engine.execute", json!({"command": command}), t)["ok"], true); + assert_eq!(h.app.ui.language, locale); + assert_eq!(crate::i18n::language(), locale); + for (mode, key) in [("basic", "Info Overlay: File"), ("exposure", "Info Overlay: Exposure"), ("off", "Info Overlay Off")] { + let expected = locale.tr(key); + if locale != Locale::En { + assert_ne!(expected, key, "this locale must translate the tested message"); + } + assert_eq!(h.request("ui.key", json!({"key": "i", "cmd": true}), t)["ok"], true); + assert_eq!(serde_json::to_value(h.app.ui.info_overlay).unwrap(), json!(mode)); + assert_eq!(h.app.ui.toast.as_ref().expect("overlay toast").0, expected); + h.step(); + let painted = h.painted_text(); + assert!(painted.iter().any(|text| text == expected), "{painted:?}"); + } + } + } + /// A click on the image zooms to the chosen click-zoom ratio (1:1 by default), animating the /// loupe while rendering once at the final size; Z uses the same ratio; a second click returns to Fit. #[test] diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 9fcfc8b9d..cd6829db4 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -705,7 +705,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option "Info Overlay: File", crate::state::InfoOverlay::Exposure => "Info Overlay: Exposure", }; - app.toast(&ctx, label); + app.toast(&ctx, crate::i18n::tr(label)); Ok(json!({"infoOverlay": app.ui.info_overlay})) } "view.chooseLayoutImage" => { From 6985cfa54cb7165bd5ad8b89249bbe81aca4e59d Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 18 Oct 2026 09:18:48 -0400 Subject: [PATCH 2/2] Drop the README notes: toast language is not README material Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- README.zh-hans.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4dba64bec..53ec908de 100644 --- a/README.md +++ b/README.md @@ -427,7 +427,7 @@ Without it LightCraft builds and runs the same, but Chinese and Japanese text ha repo — the standard for what goes there lives with it: see the [craft-fonts README](https://github.com/storytold/craft-fonts#readme). **Interface language:** **Edit → Language** (English, 简体中文, 繁體中文(台灣), 日本語, Português (Brasil), Español, Deutsch, Русский, Français, Українська, Čeština, ქართული) or **Settings → General → -Language**; the choice applies immediately and persists. Info Overlay mode-change toasts use the selected interface language. See [docs/localization.md](docs/localization.md). +Language**; the choice applies immediately and persists. See [docs/localization.md](docs/localization.md). **Logs:** the desktop app writes its log to standard error and to `logs/lightcraft.log` in its settings folder (Linux `$XDG_CONFIG_HOME/lightcraft/logs/`, by default `~/.config/lightcraft/logs/`; macOS diff --git a/README.zh-hans.md b/README.zh-hans.md index fc9373445..f2d155214 100644 --- a/README.zh-hans.md +++ b/README.zh-hans.md @@ -394,7 +394,7 @@ CRAFT_FONTS_DIR=../craft-fonts cargo run --release -p lightcraft 本仓库;见 [craftrules `standards/fonts.md`](https://github.com/storytold/craftrules/blob/main/standards/fonts.md)。 **界面语言:** **编辑 → 语言**(English、简体中文、繁體中文(台灣)、日本語、Português (Brasil)、Español、Deutsch、Русский、Français)或 **设置 → 一般 → -语言**;选择立即生效并会保留。信息叠加模式切换提示使用所选界面语言。见 [docs/localization.md](docs/localization.md)。 +语言**;选择立即生效并会保留。见 [docs/localization.md](docs/localization.md)。 **日志:** 桌面应用把日志写到标准错误,以及设置文件夹里的 `logs/lightcraft.log` (Linux `$XDG_CONFIG_HOME/lightcraft/logs/`,默认 `~/.config/lightcraft/logs/`;macOS