Fix hard-coded text

This commit is contained in:
Vic 2022-10-14 02:08:29 +08:00
parent d394d86201
commit cde272ae4d
4 changed files with 23 additions and 24 deletions

View file

@ -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();
}

View file

@ -214,9 +214,10 @@
<!-- Custom Query Shortcut Dialog -->
<system:String x:Key="customeQueryShortcutTitle">Custom Query Shortcut</system:String>
<system:String x:Key="customeQueryShortcutTips">Enter a shortcut to automatically expand to the specified query.</system:String>
<system:String x:Key="customeQueryShortcutTips">Enter a shortcut that automatically expands to the specified query.</system:String>
<system:String x:Key="dulplicateShortcut">Shortcut is dulplicate, please enter a new Shortcut or edit the existing one.</system:String>
<system:String x:Key="invalidShortcut">Invalid Shortcut</system:String>
<system:String x:Key="emptyShortcut">Shortcut and/or its expansion is empty.</system:String>
<system:String x:Key="uneditableShortcut">This shortcut cannot be deleted or edited.</system:String>
<!-- Hotkey Control -->
<system:String x:Key="hotkeyUnavailable">Hotkey Unavailable</system:String>

View file

@ -2131,8 +2131,7 @@
<GridView>
<GridViewColumn Width="180" Header="{DynamicResource hotkey}">
<GridViewColumn.CellTemplate>
<DataTemplate
="userSettings:CustomPluginHotkey">
<DataTemplate DataType="userSettings:CustomPluginHotkey">
<TextBlock Text="{Binding Hotkey}" />
</DataTemplate>
</GridViewColumn.CellTemplate>

View file

@ -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);
}
}