mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
ProcessKiller: add i18n support
This commit is contained in:
parent
a52575cc17
commit
563bf4d797
3 changed files with 34 additions and 6 deletions
|
|
@ -37,6 +37,11 @@
|
||||||
<Content Include="Images\app.png">
|
<Content Include="Images\app.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Languages\en.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="plugin.json">
|
<Content Include="plugin.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
|
||||||
10
Plugins/Flow.Launcher.Plugin.ProcessKiller/Languages/en.xaml
Normal file
10
Plugins/Flow.Launcher.Plugin.ProcessKiller/Languages/en.xaml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<system:String x:Key="flowlauncher_plugin_processkiller_plugin_name">Process Killer</system:String>
|
||||||
|
<system:String x:Key="flowlauncher_plugin_processkiller_plugin_description">Kill running processes from Flow Launcher</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="flowlauncher_plugin_processkiller_kill_all">kill all "{0}" processes</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
@ -10,7 +10,7 @@ using Flow.Launcher.Infrastructure.Logger;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.ProcessKiller
|
namespace Flow.Launcher.Plugin.ProcessKiller
|
||||||
{
|
{
|
||||||
public class Main : IPlugin
|
public class Main : IPlugin, IPluginI18n
|
||||||
{
|
{
|
||||||
private readonly HashSet<string> _systemProcessList = new HashSet<string>(){
|
private readonly HashSet<string> _systemProcessList = new HashSet<string>(){
|
||||||
"conhost",
|
"conhost",
|
||||||
|
|
@ -28,6 +28,13 @@ namespace Flow.Launcher.Plugin.ProcessKiller
|
||||||
"spoolsv",
|
"spoolsv",
|
||||||
"explorer"};
|
"explorer"};
|
||||||
|
|
||||||
|
private static PluginInitContext _context;
|
||||||
|
|
||||||
|
public void Init(PluginInitContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
var termToSearch = query.Terms.Length == 1
|
var termToSearch = query.Terms.Length == 1
|
||||||
|
|
@ -41,6 +48,16 @@ namespace Flow.Launcher.Plugin.ProcessKiller
|
||||||
: CreateResultsFromProcesses(processlist, termToSearch);
|
: CreateResultsFromProcesses(processlist, termToSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginTitle()
|
||||||
|
{
|
||||||
|
return _context.API.GetTranslation("flowlauncher_plugin_processkiller_plugin_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetTranslatedPluginDescription()
|
||||||
|
{
|
||||||
|
return _context.API.GetTranslation("flowlauncher_plugin_processkiller_plugin_description");
|
||||||
|
}
|
||||||
|
|
||||||
private List<Result> CreateResultsFromProcesses(List<ProcessResult> processlist, string termToSearch)
|
private List<Result> CreateResultsFromProcesses(List<ProcessResult> processlist, string termToSearch)
|
||||||
{
|
{
|
||||||
var results = new List<Result>();
|
var results = new List<Result>();
|
||||||
|
|
@ -69,7 +86,7 @@ namespace Flow.Launcher.Plugin.ProcessKiller
|
||||||
results.Insert(0, new Result()
|
results.Insert(0, new Result()
|
||||||
{
|
{
|
||||||
IcoPath = "Images\\app.png",
|
IcoPath = "Images\\app.png",
|
||||||
Title = "kill all \"" + termToSearch + "\" processes",
|
Title = string.Format(_context.API.GetTranslation("flowlauncher_plugin_processkiller_kill_all"), termToSearch),
|
||||||
SubTitle = "",
|
SubTitle = "",
|
||||||
Score = 200,
|
Score = 200,
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
|
|
@ -158,10 +175,6 @@ namespace Flow.Launcher.Plugin.ProcessKiller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init(PluginInitContext context)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
private enum ProcessAccessFlags : uint
|
private enum ProcessAccessFlags : uint
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue