Skip to content

Commit 3d8b732

Browse files
jjw24TBM13
authored andcommitted
Merge pull request Flow-Launcher#3849 from Flow-Launcher/translations
Add Translations for All Messages and Message Boxes
1 parent 892a9ae commit 3d8b732

File tree

8 files changed

+258
-21
lines changed

8 files changed

+258
-21
lines changed

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ private static IEnumerable<PluginPair> DotNetPlugins(List<PluginMetadata> source
100100
{
101101
var errorPluginString = string.Join(Environment.NewLine, erroredPlugins);
102102

103-
var errorMessage = "The following "
104-
+ (erroredPlugins.Count > 1 ? "plugins have " : "plugin has ")
105-
+ "errored and cannot be loaded:";
103+
var errorMessage = erroredPlugins.Count > 1 ?
104+
API.GetTranslation("pluginsHaveErrored") :
105+
API.GetTranslation("pluginHasErrored");
106106

107107
_ = Task.Run(() =>
108108
{
109-
Ioc.Default.GetRequiredService<IPublicAPI>().ShowMsgBox($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" +
109+
API.ShowMsgBox($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" +
110110
$"{errorPluginString}{Environment.NewLine}{Environment.NewLine}" +
111-
$"Please refer to the logs for more information", "",
111+
API.GetTranslation("referToLogs"), string.Empty,
112112
MessageBoxButton.OK, MessageBoxImage.Warning);
113113
});
114114
}

Flow.Launcher/Languages/en.xaml

Lines changed: 231 additions & 1 deletion
Large diffs are not rendered by default.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:system="clr-namespace:System;assembly=mscorlib">
1+
<ResourceDictionary
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:system="clr-namespace:System;assembly=mscorlib">
45

56
<system:String x:Key="flowlauncher_plugin_caculator_plugin_name">Calculator</system:String>
67
<system:String x:Key="flowlauncher_plugin_caculator_plugin_description">Allows to do mathematical calculations.(Try 5*3-2 in Flow Launcher)</system:String>
@@ -11,4 +12,5 @@
1112
<system:String x:Key="flowlauncher_plugin_calculator_decimal_seperator_comma">Comma (,)</system:String>
1213
<system:String x:Key="flowlauncher_plugin_calculator_decimal_seperator_dot">Dot (.)</system:String>
1314
<system:String x:Key="flowlauncher_plugin_calculator_max_decimal_places">Max. decimal places</system:String>
15+
<system:String x:Key="flowlauncher_plugin_calculator_failed_to_copy">Copy failed, please try later</system:String>
1416
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public List<Result> Query(Query query)
9393
}
9494
catch (ExternalException)
9595
{
96-
Context.API.ShowMsgBox("Copy failed, please try later");
96+
Context.API.ShowMsgBox(Context.API.GetTranslation("flowlauncher_plugin_calculator_failed_to_copy"));
9797
return false;
9898
}
9999
}

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ public static void StartProcess(Func<ProcessStartInfo, Process> runProcess, Proc
445445
var title = Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_error");
446446
var message = string.Format(Context.API.GetTranslation("flowlauncher_plugin_program_run_failed"),
447447
info.FileName);
448-
Context.API.ShowMsg(title, string.Format(message, info.FileName), string.Empty);
448+
Context.API.ShowMsgError(title, message);
449449
}
450450
}
451451

Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public Result Result(string query, IPublicAPI api)
462462
var message =
463463
api.GetTranslation(
464464
"flowlauncher_plugin_program_run_as_administrator_not_supported_message");
465-
api.ShowMsg(title, message, string.Empty);
465+
api.ShowMsgError(title, message);
466466
}
467467

468468
return true;

Plugins/Flow.Launcher.Plugin.Shell/Languages/en.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:system="clr-namespace:System;assembly=mscorlib">
1+
<ResourceDictionary
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:system="clr-namespace:System;assembly=mscorlib">
45

56
<system:String x:Key="flowlauncher_plugin_cmd_close_cmd_after_press">Close Command Prompt after pressing any key</system:String>
67
<system:String x:Key="flowlauncher_plugin_cmd_press_any_key_to_close">Press any key to close this window...</system:String>
@@ -15,4 +16,6 @@
1516
<system:String x:Key="flowlauncher_plugin_cmd_run_as_administrator">Run As Administrator</system:String>
1617
<system:String x:Key="flowlauncher_plugin_cmd_copy">Copy the command</system:String>
1718
<system:String x:Key="flowlauncher_plugin_cmd_history">Only show number of most used commands:</system:String>
19+
<system:String x:Key="flowlauncher_plugin_cmd_command_not_found">Command not found: {0}</system:String>
20+
<system:String x:Key="flowlauncher_plugin_cmd_error_running_command">Error running the command: {0}</system:String>
1821
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Shell/Main.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,17 @@ private void Execute(Func<ProcessStartInfo, Process> startProcess, ProcessStartI
329329
}
330330
catch (FileNotFoundException e)
331331
{
332-
var name = "Plugin: Shell";
333-
var message = $"Command not found: {e.Message}";
334-
Context.API.ShowMsg(name, message);
332+
Context.API.ShowMsgError(GetTranslatedPluginTitle(),
333+
string.Format(Context.API.GetTranslation("flowlauncher_plugin_cmd_command_not_found"), e.Message));
335334
}
336335
catch (Win32Exception e)
337336
{
338-
var name = "Plugin: Shell";
339-
var message = $"Error running the command: {e.Message}";
340-
Context.API.ShowMsg(name, message);
337+
Context.API.ShowMsgError(GetTranslatedPluginTitle(),
338+
string.Format(Context.API.GetTranslation("flowlauncher_plugin_cmd_error_running_command"), e.Message));
339+
}
340+
catch (Exception e)
341+
{
342+
Context.API.LogException(ClassName, $"Error executing command: {info.FileName} {string.Join(" ", info.ArgumentList)}", e);
341343
}
342344
}
343345

0 commit comments

Comments
 (0)