From d81c943905626223c1b70f6fee5ad15fb62777e5 Mon Sep 17 00:00:00 2001 From: danny Date: Fri, 6 Nov 2026 18:57:56 +0100 Subject: [PATCH] T1: catalog test knows theme settings, notification keys follow the convention Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/theme.rs | 2 +- ui/src/components/theme/themes.ts | 2 +- ui/src/i18n/en.json | 4 ++-- ui/tests/i18n/catalog.test.ts | 15 ++++++++++++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/theme.rs b/crates/engine/src/cmd/theme.rs index b06d3a7..5972938 100644 --- a/crates/engine/src/cmd/theme.rs +++ b/crates/engine/src/cmd/theme.rs @@ -150,7 +150,7 @@ fn broken_file(state: &mut State, path: &Path, reason: &str) { params.insert("reason".into(), Value::from(reason)); state.notify( NotificationLevel::Warning, - Some("theme.notification.skipped"), + Some("notification.theme.skipped"), Some(format!("Skipped the theme file {file}: {reason}")), Some(params), ); diff --git a/ui/src/components/theme/themes.ts b/ui/src/components/theme/themes.ts index 8919009..a90b77a 100644 --- a/ui/src/components/theme/themes.ts +++ b/ui/src/components/theme/themes.ts @@ -223,7 +223,7 @@ export const useThemesStore = defineStore("themes", () => { const name = (result.value as { name?: unknown } | null)?.name; notifications.notify({ level: "info", - messageKey: "theme.import.done", + messageKey: "notification.theme.imported", params: { name: typeof name === "string" ? name : picked.value }, }); } diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json index 035623c..f000dfe 100644 --- a/ui/src/i18n/en.json +++ b/ui/src/i18n/en.json @@ -276,6 +276,8 @@ "notification.settings.unavailable": "Settings cannot be loaded ({error}). The defaults are used and changes are not saved.", "notification.stack.label": "Notifications", "notification.stack.more": "+{count} more", + "notification.theme.imported": "Imported the theme {name}.", + "notification.theme.skipped": "Skipped the theme file {file}: {reason}", "notification.toolchain.downloadDone": "Phpactor {version} is ready, downloaded and verified in {seconds} s.", "notification.toolchain.downloadFailed": "Phpactor {version} could not be downloaded: {reason}", "notification.toolchain.downloadStarted": "Downloading Phpactor {version} from GitHub for PHP language features…", @@ -446,7 +448,6 @@ "terminal.tab.numbered": "Local ({n})", "terminal.tabs.label": "Terminals", "terminal.toolWindow.title": "Terminal", - "theme.import.done": "Imported the theme {name}.", "theme.import.title": "Import Theme", "theme.lutraDark": "Lutra Dark", "theme.lutraLight": "Lutra Light", @@ -454,7 +455,6 @@ "theme.lutraPlumNight": "Plum Night", "theme.lutraReed": "Reed", "theme.lutraRiver": "River", - "theme.notification.skipped": "Skipped the theme file {file}: {reason}", "theme.picker.current": "current", "theme.picker.dark": "Dark", "theme.picker.followsSystem": "Follows the light or dark preference of your operating system", diff --git a/ui/tests/i18n/catalog.test.ts b/ui/tests/i18n/catalog.test.ts index 33d41e8..ff482bc 100644 --- a/ui/tests/i18n/catalog.test.ts +++ b/ui/tests/i18n/catalog.test.ts @@ -85,10 +85,18 @@ function camel(value: string): string { * - Rust `*_key: "…"` fields: theme labels and the settings' `labelKey` * and `descriptionKey`; * - per settings definition, its section name (`settings.section.`) and - * each enum value (`settings..value.`). + * each enum value (`settings..value.`); a `Kind::Theme` + * setting has every built-in theme id of `theme.rs` and `system` as + * values (C9 T1). */ const RUNTIME_KEYS = (() => { const keys = new Set(); + const themeIds = [ + ...[...shippedRust(join(REPO, "crates", "engine", "src", "theme.rs")).matchAll(/\bid:\s*"([a-z0-9-]+)"/g)].map( + (m) => m[1] ?? "", + ), + "system", + ]; const add = (text: string, pattern: RegExp): void => { for (const m of text.matchAll(pattern)) { keys.add(m[1] ?? ""); @@ -112,6 +120,11 @@ const RUNTIME_KEYS = (() => { for (const value of values.matchAll(/"([^"]+)"/g)) { keys.add(`settings.${key ?? ""}.value.${camel(value[1] ?? "")}`); } + if (/Kind::Theme\b/.test(body)) { + for (const id of themeIds) { + keys.add(`settings.${key ?? ""}.value.${camel(id)}`); + } + } } } keys.delete("");