diff --git a/src/ui/app.rs b/src/ui/app.rs index bf5c4880..4b1a9eda 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -1388,7 +1388,17 @@ impl Tty7App { crate::ui::presets::load_registry(cx); self.set_preset(&new_id, window, cx); } - Err(e) => log::warn!("failed to duplicate theme: {e}"), + // A button that does nothing is the worst kind of failure: there + // is no way to tell it from "I clicked the wrong thing". + Err(e) => { + log::warn!("failed to duplicate theme: {e}"); + crate::ui::host_ops::HostOps::notify_err( + window, + cx, + t(L10nKey::ThemeDuplicateFailed), + &e, + ); + } } } @@ -1405,7 +1415,10 @@ impl Tty7App { } mutate(&mut theme); if let Err(e) = crate::ui::presets::write_theme_file(&theme) { + // Every colour edit runs through here. Without this the picker + // moves, the theme does not, and nothing says why. log::warn!("failed to write theme file: {e}"); + crate::ui::host_ops::HostOps::notify_err(window, cx, t(L10nKey::ThemeSaveFailed), &e); return; } crate::ui::presets::load_registry(cx); diff --git a/src/ui/i18n/en.rs b/src/ui/i18n/en.rs index d2076104..120484c4 100644 --- a/src/ui/i18n/en.rs +++ b/src/ui/i18n/en.rs @@ -134,6 +134,9 @@ pub fn translate_en(key: L10nKey) -> &'static str { } L10nKey::SettingsAnsiColors => "ANSI colors", L10nKey::SettingsCustomThemes => "Custom themes", + L10nKey::ThemeDuplicateFailed => "Could not duplicate the theme", + L10nKey::ThemeSaveFailed => "Could not save the theme", + L10nKey::OpenInFileManagerFailed => "Could not open {path}", L10nKey::SettingsCustomThemesIntro => { "Duplicate a theme to edit its colors here, or drop your own in the themes folder: a tty7 YAML theme or an iTerm2 .itermcolors scheme." } diff --git a/src/ui/i18n/ja.rs b/src/ui/i18n/ja.rs index c80b0aa9..c3219cd5 100644 --- a/src/ui/i18n/ja.rs +++ b/src/ui/i18n/ja.rs @@ -134,6 +134,9 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> { L10nKey::SettingsBackgroundImageDesc => "背景色の上、テキストの下に表示されます", L10nKey::SettingsAnsiColors => "ANSI カラー", L10nKey::SettingsCustomThemes => "カスタムテーマ", + L10nKey::ThemeDuplicateFailed => "テーマを複製できませんでした", + L10nKey::ThemeSaveFailed => "テーマを保存できませんでした", + L10nKey::OpenInFileManagerFailed => "{path} を開けませんでした", L10nKey::SettingsCustomThemesIntro => { "テーマを複製して色を編集するか、テーマフォルダに自作テーマ(tty7 の YAML テーマまたは iTerm2 の .itermcolors スキーム)を置けます" } diff --git a/src/ui/i18n/mod.rs b/src/ui/i18n/mod.rs index f23e49e8..d1a6c5ba 100644 --- a/src/ui/i18n/mod.rs +++ b/src/ui/i18n/mod.rs @@ -161,6 +161,9 @@ pub enum L10nKey { SettingsBackgroundImageDesc, SettingsAnsiColors, SettingsCustomThemes, + ThemeDuplicateFailed, + ThemeSaveFailed, + OpenInFileManagerFailed, SettingsCustomThemesIntro, SettingsDuplicateToEdit, SettingsHosts, @@ -1202,6 +1205,9 @@ mod tests { L10nKey::SettingsBackgroundImageDesc, L10nKey::SettingsAnsiColors, L10nKey::SettingsCustomThemes, + L10nKey::ThemeDuplicateFailed, + L10nKey::ThemeSaveFailed, + L10nKey::OpenInFileManagerFailed, L10nKey::SettingsCustomThemesIntro, L10nKey::SettingsDuplicateToEdit, L10nKey::SettingsHosts, diff --git a/src/ui/i18n/zh.rs b/src/ui/i18n/zh.rs index 2d997d9b..a7e6ccfe 100644 --- a/src/ui/i18n/zh.rs +++ b/src/ui/i18n/zh.rs @@ -118,6 +118,9 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> { L10nKey::SettingsBackgroundImageDesc => "叠加在背景色之上、文字之下。", L10nKey::SettingsAnsiColors => "ANSI 颜色", L10nKey::SettingsCustomThemes => "自定义主题", + L10nKey::ThemeDuplicateFailed => "无法复制主题", + L10nKey::ThemeSaveFailed => "无法保存主题", + L10nKey::OpenInFileManagerFailed => "无法打开 {path}", L10nKey::SettingsCustomThemesIntro => { "复制一个主题后可在此编辑其颜色,或者把自定义主题放入主题文件夹:tty7 YAML 主题或 iTerm2 的 .itermcolors 方案。" }