|
13 | 13 | using ISavable = Flow.Launcher.Plugin.ISavable; |
14 | 14 | using Flow.Launcher.Plugin.SharedCommands; |
15 | 15 | using System.Text.Json; |
| 16 | +using Flow.Launcher.Core.Resource; |
16 | 17 |
|
17 | 18 | namespace Flow.Launcher.Core.Plugin |
18 | 19 | { |
@@ -51,7 +52,7 @@ private static void DeletePythonBinding() |
51 | 52 | } |
52 | 53 |
|
53 | 54 | /// <summary> |
54 | | - /// Save json and ISavable |
| 55 | + /// Save json and ISavable |
55 | 56 | /// </summary> |
56 | 57 | public static void Save() |
57 | 58 | { |
@@ -202,24 +203,33 @@ public static async Task InitializePluginsAsync(IPublicAPI api) |
202 | 203 | } |
203 | 204 | } |
204 | 205 |
|
| 206 | + InternationalizationManager.Instance.AddPluginLanguageDirectories(GetPluginsForInterface<IPluginI18n>()); |
| 207 | + InternationalizationManager.Instance.ChangeLanguage(InternationalizationManager.Instance.Settings.Language); |
| 208 | + |
205 | 209 | if (failedPlugins.Any()) |
206 | 210 | { |
207 | 211 | var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name)); |
208 | | - API.ShowMsg($"Fail to Init Plugins", |
209 | | - $"Plugins: {failed} - fail to load and would be disabled, please contact plugin creator for help", |
210 | | - "", false); |
| 212 | + API.ShowMsg( |
| 213 | + InternationalizationManager.Instance.GetTranslation("failedToInitializePluginsTitle"), |
| 214 | + string.Format( |
| 215 | + InternationalizationManager.Instance.GetTranslation("failedToInitializePluginsMessage"), |
| 216 | + failed |
| 217 | + ), |
| 218 | + "", |
| 219 | + false |
| 220 | + ); |
211 | 221 | } |
212 | 222 | } |
213 | 223 |
|
214 | 224 | public static ICollection<PluginPair> ValidPluginsForQuery(Query query) |
215 | 225 | { |
216 | 226 | if (query is null) |
217 | 227 | return Array.Empty<PluginPair>(); |
218 | | - |
| 228 | + |
219 | 229 | if (!NonGlobalPlugins.ContainsKey(query.ActionKeyword)) |
220 | 230 | return GlobalPlugins; |
221 | | - |
222 | | - |
| 231 | + |
| 232 | + |
223 | 233 | var plugin = NonGlobalPlugins[query.ActionKeyword]; |
224 | 234 | return new List<PluginPair> |
225 | 235 | { |
@@ -279,8 +289,8 @@ public static void UpdatePluginMetadata(List<Result> results, PluginMetadata met |
279 | 289 | r.PluginID = metadata.ID; |
280 | 290 | r.OriginQuery = query; |
281 | 291 |
|
282 | | - // ActionKeywordAssigned is used for constructing MainViewModel's query text auto-complete suggestions |
283 | | - // Plugins may have multi-actionkeywords eg. WebSearches. In this scenario it needs to be overriden on the plugin level |
| 292 | + // ActionKeywordAssigned is used for constructing MainViewModel's query text auto-complete suggestions |
| 293 | + // Plugins may have multi-actionkeywords eg. WebSearches. In this scenario it needs to be overriden on the plugin level |
284 | 294 | if (metadata.ActionKeywords.Count == 1) |
285 | 295 | r.ActionKeywordAssigned = query.ActionKeyword; |
286 | 296 | } |
@@ -463,7 +473,7 @@ internal static void InstallPlugin(UserPlugin plugin, string zipFilePath, bool c |
463 | 473 | // Unzip plugin files to temp folder |
464 | 474 | var tempFolderPluginPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); |
465 | 475 | System.IO.Compression.ZipFile.ExtractToDirectory(zipFilePath, tempFolderPluginPath); |
466 | | - |
| 476 | + |
467 | 477 | if(!plugin.IsFromLocalInstallPath) |
468 | 478 | File.Delete(zipFilePath); |
469 | 479 |
|
|
0 commit comments