@@ -17,7 +17,7 @@ public class Main : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, IDispo
17
17
{
18
18
private static readonly string ClassName = nameof ( Main ) ;
19
19
20
- internal PluginInitContext Context { get ; private set ; }
20
+ internal static PluginInitContext Context { get ; private set ; }
21
21
22
22
private const string Image = "Images/shell.png" ;
23
23
private bool _winRStroked ;
@@ -103,14 +103,14 @@ private List<Result> GetHistoryCmds(string cmd, Result result)
103
103
{
104
104
if ( m . Key == cmd )
105
105
{
106
- result . SubTitle = string . Format ( Context . API . GetTranslation ( " flowlauncher_plugin_cmd_cmd_has_been_executed_times" ) , m . Value ) ;
106
+ result . SubTitle = Localize . flowlauncher_plugin_cmd_cmd_has_been_executed_times ( m . Value ) ;
107
107
return null ;
108
108
}
109
109
110
110
var ret = new Result
111
111
{
112
112
Title = m . Key ,
113
- SubTitle = string . Format ( Context . API . GetTranslation ( " flowlauncher_plugin_cmd_cmd_has_been_executed_times" ) , m . Value ) ,
113
+ SubTitle = Localize . flowlauncher_plugin_cmd_cmd_has_been_executed_times ( m . Value ) ,
114
114
IcoPath = Image ,
115
115
Action = c =>
116
116
{
@@ -140,7 +140,7 @@ private Result GetCurrentCmd(string cmd)
140
140
{
141
141
Title = cmd ,
142
142
Score = 5000 ,
143
- SubTitle = Context . API . GetTranslation ( " flowlauncher_plugin_cmd_execute_through_shell" ) ,
143
+ SubTitle = Localize . flowlauncher_plugin_cmd_execute_through_shell ( ) ,
144
144
IcoPath = Image ,
145
145
Action = c =>
146
146
{
@@ -165,7 +165,7 @@ private List<Result> ResultsFromHistory()
165
165
. Select ( m => new Result
166
166
{
167
167
Title = m . Key ,
168
- SubTitle = string . Format ( Context . API . GetTranslation ( " flowlauncher_plugin_cmd_cmd_has_been_executed_times" ) , m . Value ) ,
168
+ SubTitle = Localize . flowlauncher_plugin_cmd_cmd_has_been_executed_times ( m . Value ) ,
169
169
IcoPath = Image ,
170
170
Action = c =>
171
171
{
@@ -199,7 +199,7 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
199
199
Verb = runAsAdministratorArg ,
200
200
WorkingDirectory = workingDirectory ,
201
201
} ;
202
- var notifyStr = Context . API . GetTranslation ( " flowlauncher_plugin_cmd_press_any_key_to_close" ) ;
202
+ var notifyStr = Localize . flowlauncher_plugin_cmd_press_any_key_to_close ( ) ;
203
203
var addedCharacter = _settings . UseWindowsTerminal ? "\\ " : "" ;
204
204
switch ( _settings . Shell )
205
205
{
@@ -336,12 +336,12 @@ private void Execute(Func<ProcessStartInfo, Process> startProcess, ProcessStartI
336
336
catch ( FileNotFoundException e )
337
337
{
338
338
Context . API . ShowMsgError ( GetTranslatedPluginTitle ( ) ,
339
- string . Format ( Context . API . GetTranslation ( " flowlauncher_plugin_cmd_command_not_found" ) , e . Message ) ) ;
339
+ Localize . flowlauncher_plugin_cmd_command_not_found ( e . Message ) ) ;
340
340
}
341
341
catch ( Win32Exception e )
342
342
{
343
343
Context . API . ShowMsgError ( GetTranslatedPluginTitle ( ) ,
344
- string . Format ( Context . API . GetTranslation ( " flowlauncher_plugin_cmd_error_running_command" ) , e . Message ) ) ;
344
+ Localize . flowlauncher_plugin_cmd_error_running_command ( e . Message ) ) ;
345
345
}
346
346
catch ( Exception e )
347
347
{
@@ -405,7 +405,7 @@ bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state)
405
405
return true ;
406
406
}
407
407
408
- private void OnWinRPressed ( )
408
+ private static void OnWinRPressed ( )
409
409
{
410
410
Context . API . ShowMainWindow ( ) ;
411
411
// show the main window and set focus to the query box
@@ -428,12 +428,12 @@ public Control CreateSettingPanel()
428
428
429
429
public string GetTranslatedPluginTitle ( )
430
430
{
431
- return Context . API . GetTranslation ( " flowlauncher_plugin_cmd_plugin_name" ) ;
431
+ return Localize . flowlauncher_plugin_cmd_plugin_name ( ) ;
432
432
}
433
433
434
434
public string GetTranslatedPluginDescription ( )
435
435
{
436
- return Context . API . GetTranslation ( " flowlauncher_plugin_cmd_plugin_description" ) ;
436
+ return Localize . flowlauncher_plugin_cmd_plugin_description ( ) ;
437
437
}
438
438
439
439
public List < Result > LoadContextMenus ( Result selectedResult )
@@ -442,7 +442,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
442
442
{
443
443
new ( )
444
444
{
445
- Title = Context . API . GetTranslation ( " flowlauncher_plugin_cmd_run_as_different_user" ) ,
445
+ Title = Localize . flowlauncher_plugin_cmd_run_as_different_user ( ) ,
446
446
Action = c =>
447
447
{
448
448
Execute ( ShellCommand . RunAsDifferentUser , PrepareProcessStartInfo ( selectedResult . Title ) ) ;
@@ -453,7 +453,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
453
453
} ,
454
454
new ( )
455
455
{
456
- Title = Context . API . GetTranslation ( " flowlauncher_plugin_cmd_run_as_administrator" ) ,
456
+ Title = Localize . flowlauncher_plugin_cmd_run_as_administrator ( ) ,
457
457
Action = c =>
458
458
{
459
459
Execute ( Process . Start , PrepareProcessStartInfo ( selectedResult . Title , true ) ) ;
@@ -464,7 +464,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
464
464
} ,
465
465
new ( )
466
466
{
467
- Title = Context . API . GetTranslation ( " flowlauncher_plugin_cmd_copy" ) ,
467
+ Title = Localize . flowlauncher_plugin_cmd_copy ( ) ,
468
468
Action = c =>
469
469
{
470
470
Context . API . CopyToClipboard ( selectedResult . Title ) ;
0 commit comments