From cde272ae4dad6d3efb6a238fd72cc47708e475a4 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Fri, 14 Oct 2022 02:08:29 +0800 Subject: [PATCH] Fix hard-coded text --- Flow.Launcher/CustomShortcutSetting.xaml.cs | 10 +++---- Flow.Launcher/Languages/en.xaml | 5 ++-- Flow.Launcher/SettingWindow.xaml | 3 +-- Flow.Launcher/SettingWindow.xaml.cs | 29 ++++++++++----------- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs index f3d1895a1..aa029f7c3 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml.cs +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -37,16 +37,16 @@ namespace Flow.Launcher private void BtnAdd_OnClick(object sender, RoutedEventArgs e) { + if (String.IsNullOrEmpty(Key) || String.IsNullOrEmpty(Value)) + { + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("emptyShortcut")); + return; + } if (!update && (_settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value)) || _settings.BuiltinShortcuts.Contains(new CustomShortcutModel(Key, Value)))) { MessageBox.Show(InternationalizationManager.Instance.GetTranslation("dulplicateShortcut")); return; } - if (String.IsNullOrEmpty(Key) || String.IsNullOrEmpty(Value)) - { - MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidShortcut")); - return; - } DialogResult = true; Close(); } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 59a57ca80..292ae7e0d 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -214,9 +214,10 @@ Custom Query Shortcut - Enter a shortcut to automatically expand to the specified query. + Enter a shortcut that automatically expands to the specified query. Shortcut is dulplicate, please enter a new Shortcut or edit the existing one. - Invalid Shortcut + Shortcut and/or its expansion is empty. + This shortcut cannot be deleted or edited. Hotkey Unavailable diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 907a6aa6d..858e579fb 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2131,8 +2131,7 @@ - + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 261903da6..0b31b5996 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -383,7 +383,7 @@ namespace Flow.Launcher } else if (!item.CanBeEdited) { - MessageBox.Show("This shortcut cannot be deleted or edited."); // TODO + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("uneditableShortcut")); return; } @@ -401,22 +401,21 @@ namespace Flow.Launcher private void OnEditCustomShortCutClick(object sender, RoutedEventArgs e) { var item = viewModel.SelectedCustomShortcut; - if (item != null) - { - if (!item.CanBeEdited) - { - MessageBox.Show("This shortcut cannot be deleted or edited."); - return; - } - var shortcutSettingWindow = new CustomShortcutSetting(item, settings); - if (shortcutSettingWindow.ShowDialog() == true) - { - viewModel.EditShortcut(item, shortcutSettingWindow.ShortCut); - } - } - else + if (item == null) { MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem")); + return; + } + else if (!item.CanBeEdited) + { + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("uneditableShortcut")); + return; + } + + var shortcutSettingWindow = new CustomShortcutSetting(item, settings); + if (shortcutSettingWindow.ShowDialog() == true) + { + viewModel.EditShortcut(item, shortcutSettingWindow.ShortCut); } }