Fix hard-coded translation

This commit is contained in:
Vic 2022-11-29 18:13:55 +08:00
parent 422307d507
commit 592b838f3e
3 changed files with 7 additions and 4 deletions

View file

@ -81,7 +81,9 @@
<!-- Dialogs -->
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">Success</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_error">Error</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">Successfully disabled this program from displaying in your query</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_failed">Unable to run {0}</system:String>
</ResourceDictionary>

View file

@ -5,6 +5,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Plugin.Program.Programs;
@ -225,9 +226,9 @@ namespace Flow.Launcher.Plugin.Program
}
catch (Exception)
{
var name = "Plugin: Program";
var message = $"Unable to start: {info.FileName}";
Context.API.ShowMsg(name, message, string.Empty);
var title = Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_error");
var message = string.Format(Context.API.GetTranslation("flowlauncher_plugin_program_run_failed"), info.FileName);
Context.API.ShowMsg(title, string.Format(message, info.FileName), string.Empty);
}
}

View file

@ -421,7 +421,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
_ = Task.Run(() => Launch(shouldRunElevated)).ConfigureAwait(false);
if (elevated && !shouldRunElevated)
{
var title = "Plugin: Program";
var title = api.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_error");
var message = api.GetTranslation("flowlauncher_plugin_program_run_as_administrator_not_supported_message");
api.ShowMsg(title, message, string.Empty);
}