mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use Flow.Launcher.Localization to improve code quality
This commit is contained in:
parent
d87650de08
commit
7350c1d4d5
19 changed files with 129 additions and 131 deletions
|
|
@ -45,7 +45,7 @@ namespace Flow.Launcher.Core.Configuration
|
|||
#endif
|
||||
IndicateDeletion(DataLocation.PortableDataPath);
|
||||
|
||||
API.ShowMsgBox(API.GetTranslation("restartToDisablePortableMode"));
|
||||
API.ShowMsgBox(Localize.restartToDisablePortableMode());
|
||||
|
||||
UpdateManager.RestartApp(Constant.ApplicationFileName);
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ namespace Flow.Launcher.Core.Configuration
|
|||
#endif
|
||||
IndicateDeletion(DataLocation.RoamingDataPath);
|
||||
|
||||
API.ShowMsgBox(API.GetTranslation("restartToEnablePortableMode"));
|
||||
API.ShowMsgBox(Localize.restartToEnablePortableMode());
|
||||
|
||||
UpdateManager.RestartApp(Constant.ApplicationFileName);
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ namespace Flow.Launcher.Core.Configuration
|
|||
{
|
||||
FilesFolders.RemoveFolderIfExists(roamingDataDir, (s) => API.ShowMsgBox(s));
|
||||
|
||||
if (API.ShowMsgBox(API.GetTranslation("moveToDifferentLocation"),
|
||||
if (API.ShowMsgBox(Localize.moveToDifferentLocation(),
|
||||
string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
FilesFolders.OpenPath(Constant.RootDirectory, (s) => API.ShowMsgBox(s));
|
||||
|
|
@ -166,7 +166,7 @@ namespace Flow.Launcher.Core.Configuration
|
|||
{
|
||||
FilesFolders.RemoveFolderIfExists(portableDataDir, (s) => API.ShowMsgBox(s));
|
||||
|
||||
API.ShowMsgBox(API.GetTranslation("shortcutsUninstallerCreated"));
|
||||
API.ShowMsgBox(Localize.shortcutsUninstallerCreated());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,8 +177,7 @@ namespace Flow.Launcher.Core.Configuration
|
|||
|
||||
if (roamingLocationExists && portableLocationExists)
|
||||
{
|
||||
API.ShowMsgBox(string.Format(API.GetTranslation("userDataDuplicated"),
|
||||
DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine));
|
||||
API.ShowMsgBox(Localize.userDataDuplicated(DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,15 +58,10 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|||
return SetPathForPluginPairs(PluginsSettingsFilePath, Language);
|
||||
}
|
||||
|
||||
var noRuntimeMessage = string.Format(
|
||||
API.GetTranslation("runtimePluginInstalledChooseRuntimePrompt"),
|
||||
Language,
|
||||
EnvName,
|
||||
Environment.NewLine
|
||||
);
|
||||
var noRuntimeMessage = Localize.runtimePluginInstalledChooseRuntimePrompt(Language, EnvName, Environment.NewLine);
|
||||
if (API.ShowMsgBox(noRuntimeMessage, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
|
||||
{
|
||||
var msg = string.Format(API.GetTranslation("runtimePluginChooseRuntimeExecutable"), EnvName);
|
||||
var msg = Localize.runtimePluginChooseRuntimeExecutable(EnvName);
|
||||
|
||||
var selectedFile = GetFileFromDialog(msg, FileDialogFilter);
|
||||
|
||||
|
|
@ -77,12 +72,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|||
// Nothing selected because user pressed cancel from the file dialog window
|
||||
else
|
||||
{
|
||||
var forceDownloadMessage = string.Format(
|
||||
API.GetTranslation("runtimeExecutableInvalidChooseDownload"),
|
||||
Language,
|
||||
EnvName,
|
||||
Environment.NewLine
|
||||
);
|
||||
var forceDownloadMessage = Localize.runtimeExecutableInvalidChooseDownload(Language, EnvName, Environment.NewLine);
|
||||
|
||||
// Let users select valid path or choose to download
|
||||
while (string.IsNullOrEmpty(selectedFile))
|
||||
|
|
@ -120,7 +110,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|||
}
|
||||
else
|
||||
{
|
||||
API.ShowMsgBox(string.Format(API.GetTranslation("runtimePluginUnableToSetExecutablePath"), Language));
|
||||
API.ShowMsgBox(Localize.runtimePluginUnableToSetExecutablePath(Language));
|
||||
API.LogError(ClassName,
|
||||
$"Not able to successfully set {EnvName} path, setting's plugin executable path variable is still an empty string.",
|
||||
$"{Language}Environment");
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
API.ShowMsgError(API.GetTranslation("failToInstallPythonEnv"));
|
||||
API.ShowMsgError(Localize.failToInstallPythonEnv());
|
||||
API.LogException(ClassName, "Failed to install Python environment", e);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
API.ShowMsgError(API.GetTranslation("failToInstallTypeScriptEnv"));
|
||||
API.ShowMsgError(Localize.failToInstallTypeScriptEnv());
|
||||
API.LogException(ClassName, "Failed to install TypeScript environment", e);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
API.ShowMsgError(API.GetTranslation("failToInstallTypeScriptEnv"));
|
||||
API.ShowMsgError(Localize.failToInstallTypeScriptEnv());
|
||||
API.LogException(ClassName, "Failed to install TypeScript environment", e);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows</TargetFramework>
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<NoWarn>$(NoWarn);FLSG0007</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -55,6 +56,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Droplex" Version="1.7.0" />
|
||||
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.6" />
|
||||
<PackageReference Include="FSharp.Core" Version="9.0.303" />
|
||||
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.4.4" />
|
||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
|
||||
|
|
@ -62,6 +64,17 @@
|
|||
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
|
||||
<PackageReference Include="StreamJsonRpc" Version="2.22.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<FLLUseDependencyInjection>true</FLLUseDependencyInjection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Remove="Languages\en.xaml" />
|
||||
<AdditionalFiles Include="..\Flow.Launcher\Languages\en.xaml">
|
||||
<Link>Languages\en.xaml</Link>
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ namespace Flow.Launcher.Core.Plugin
|
|||
HorizontalAlignment = HorizontalAlignment.Left,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Margin = SettingPanelItemLeftMargin,
|
||||
Content = API.GetTranslation("select")
|
||||
Content = Localize.select()
|
||||
};
|
||||
|
||||
Btn.Click += (_, _) =>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
|
|
@ -35,16 +35,14 @@ public static class PluginInstaller
|
|||
{
|
||||
if (API.PluginModified(newPlugin.ID))
|
||||
{
|
||||
API.ShowMsgError(string.Format(API.GetTranslation("pluginModifiedAlreadyTitle"), newPlugin.Name),
|
||||
API.GetTranslation("pluginModifiedAlreadyMessage"));
|
||||
API.ShowMsgError(Localize.pluginModifiedAlreadyTitle(newPlugin.Name),
|
||||
Localize.pluginModifiedAlreadyMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (API.ShowMsgBox(
|
||||
string.Format(
|
||||
API.GetTranslation("InstallPromptSubtitle"),
|
||||
newPlugin.Name, newPlugin.Author, Environment.NewLine),
|
||||
API.GetTranslation("InstallPromptTitle"),
|
||||
Localize.InstallPromptSubtitle(newPlugin.Name, newPlugin.Author, Environment.NewLine),
|
||||
Localize.InstallPromptTitle(),
|
||||
button: MessageBoxButton.YesNo) != MessageBoxResult.Yes) return;
|
||||
|
||||
try
|
||||
|
|
@ -61,7 +59,7 @@ public static class PluginInstaller
|
|||
if (!newPlugin.IsFromLocalInstallPath)
|
||||
{
|
||||
await DownloadFileAsync(
|
||||
$"{API.GetTranslation("DownloadingPlugin")} {newPlugin.Name}",
|
||||
$"{Localize.DownloadingPlugin()} {newPlugin.Name}",
|
||||
newPlugin.UrlDownload, filePath, cts);
|
||||
}
|
||||
else
|
||||
|
|
@ -93,7 +91,7 @@ public static class PluginInstaller
|
|||
catch (Exception e)
|
||||
{
|
||||
API.LogException(ClassName, "Failed to install plugin", e);
|
||||
API.ShowMsgError(API.GetTranslation("ErrorInstallingPlugin"));
|
||||
API.ShowMsgError(Localize.ErrorInstallingPlugin());
|
||||
return; // do not restart on failure
|
||||
}
|
||||
|
||||
|
|
@ -104,11 +102,8 @@ public static class PluginInstaller
|
|||
else
|
||||
{
|
||||
API.ShowMsg(
|
||||
API.GetTranslation("installbtn"),
|
||||
string.Format(
|
||||
API.GetTranslation(
|
||||
"InstallSuccessNoRestart"),
|
||||
newPlugin.Name));
|
||||
Localize.installbtn(),
|
||||
Localize.InstallSuccessNoRestart(newPlugin.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -134,23 +129,22 @@ public static class PluginInstaller
|
|||
catch (Exception e)
|
||||
{
|
||||
API.LogException(ClassName, "Failed to validate zip file", e);
|
||||
API.ShowMsgError(API.GetTranslation("ZipFileNotHavePluginJson"));
|
||||
API.ShowMsgError(Localize.ZipFileNotHavePluginJson());
|
||||
return;
|
||||
}
|
||||
|
||||
if (API.PluginModified(plugin.ID))
|
||||
{
|
||||
API.ShowMsgError(string.Format(API.GetTranslation("pluginModifiedAlreadyTitle"), plugin.Name),
|
||||
API.GetTranslation("pluginModifiedAlreadyMessage"));
|
||||
API.ShowMsgError(Localize.pluginModifiedAlreadyTitle(plugin.Name),
|
||||
Localize.pluginModifiedAlreadyMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.ShowUnknownSourceWarning)
|
||||
{
|
||||
if (!InstallSourceKnown(plugin.Website)
|
||||
&& API.ShowMsgBox(string.Format(
|
||||
API.GetTranslation("InstallFromUnknownSourceSubtitle"), Environment.NewLine),
|
||||
API.GetTranslation("InstallFromUnknownSourceTitle"),
|
||||
&& API.ShowMsgBox(Localize.InstallFromUnknownSourceSubtitle(Environment.NewLine),
|
||||
Localize.InstallFromUnknownSourceTitle(),
|
||||
MessageBoxButton.YesNo) == MessageBoxResult.No)
|
||||
return;
|
||||
}
|
||||
|
|
@ -167,21 +161,19 @@ public static class PluginInstaller
|
|||
{
|
||||
if (API.PluginModified(oldPlugin.ID))
|
||||
{
|
||||
API.ShowMsgError(string.Format(API.GetTranslation("pluginModifiedAlreadyTitle"), oldPlugin.Name),
|
||||
API.GetTranslation("pluginModifiedAlreadyMessage"));
|
||||
API.ShowMsgError(Localize.pluginModifiedAlreadyTitle(oldPlugin.Name),
|
||||
Localize.pluginModifiedAlreadyMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (API.ShowMsgBox(
|
||||
string.Format(
|
||||
API.GetTranslation("UninstallPromptSubtitle"),
|
||||
oldPlugin.Name, oldPlugin.Author, Environment.NewLine),
|
||||
API.GetTranslation("UninstallPromptTitle"),
|
||||
Localize.UninstallPromptSubtitle(oldPlugin.Name, oldPlugin.Author, Environment.NewLine),
|
||||
Localize.UninstallPromptTitle(),
|
||||
button: MessageBoxButton.YesNo) != MessageBoxResult.Yes) return;
|
||||
|
||||
var removePluginSettings = API.ShowMsgBox(
|
||||
API.GetTranslation("KeepPluginSettingsSubtitle"),
|
||||
API.GetTranslation("KeepPluginSettingsTitle"),
|
||||
Localize.KeepPluginSettingsSubtitle(),
|
||||
Localize.KeepPluginSettingsTitle(),
|
||||
button: MessageBoxButton.YesNo) == MessageBoxResult.No;
|
||||
|
||||
try
|
||||
|
|
@ -194,7 +186,7 @@ public static class PluginInstaller
|
|||
catch (Exception e)
|
||||
{
|
||||
API.LogException(ClassName, "Failed to uninstall plugin", e);
|
||||
API.ShowMsgError(API.GetTranslation("ErrorUninstallingPlugin"));
|
||||
API.ShowMsgError(Localize.ErrorUninstallingPlugin());
|
||||
return; // don not restart on failure
|
||||
}
|
||||
|
||||
|
|
@ -205,11 +197,8 @@ public static class PluginInstaller
|
|||
else
|
||||
{
|
||||
API.ShowMsg(
|
||||
API.GetTranslation("uninstallbtn"),
|
||||
string.Format(
|
||||
API.GetTranslation(
|
||||
"UninstallSuccessNoRestart"),
|
||||
oldPlugin.Name));
|
||||
Localize.uninstallbtn(),
|
||||
Localize.UninstallSuccessNoRestart(oldPlugin.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -222,10 +211,8 @@ public static class PluginInstaller
|
|||
public static async Task UpdatePluginAndCheckRestartAsync(UserPlugin newPlugin, PluginMetadata oldPlugin)
|
||||
{
|
||||
if (API.ShowMsgBox(
|
||||
string.Format(
|
||||
API.GetTranslation("UpdatePromptSubtitle"),
|
||||
oldPlugin.Name, oldPlugin.Author, Environment.NewLine),
|
||||
API.GetTranslation("UpdatePromptTitle"),
|
||||
Localize.UpdatePromptSubtitle(oldPlugin.Name, oldPlugin.Author, Environment.NewLine),
|
||||
Localize.UpdatePromptTitle(),
|
||||
button: MessageBoxButton.YesNo) != MessageBoxResult.Yes) return;
|
||||
|
||||
try
|
||||
|
|
@ -237,7 +224,7 @@ public static class PluginInstaller
|
|||
if (!newPlugin.IsFromLocalInstallPath)
|
||||
{
|
||||
await DownloadFileAsync(
|
||||
$"{API.GetTranslation("DownloadingPlugin")} {newPlugin.Name}",
|
||||
$"{Localize.DownloadingPlugin()} {newPlugin.Name}",
|
||||
newPlugin.UrlDownload, filePath, cts);
|
||||
}
|
||||
else
|
||||
|
|
@ -259,7 +246,7 @@ public static class PluginInstaller
|
|||
catch (Exception e)
|
||||
{
|
||||
API.LogException(ClassName, "Failed to update plugin", e);
|
||||
API.ShowMsgError(API.GetTranslation("ErrorUpdatingPlugin"));
|
||||
API.ShowMsgError(Localize.ErrorUpdatingPlugin());
|
||||
return; // do not restart on failure
|
||||
}
|
||||
|
||||
|
|
@ -270,11 +257,8 @@ public static class PluginInstaller
|
|||
else
|
||||
{
|
||||
API.ShowMsg(
|
||||
API.GetTranslation("updatebtn"),
|
||||
string.Format(
|
||||
API.GetTranslation(
|
||||
"UpdateSuccessNoRestart"),
|
||||
newPlugin.Name));
|
||||
Localize.updatebtn(),
|
||||
Localize.UpdateSuccessNoRestart(newPlugin.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -314,11 +298,11 @@ public static class PluginInstaller
|
|||
}).ToList();
|
||||
|
||||
// No updates
|
||||
if (!resultsForUpdate.Any())
|
||||
if (resultsForUpdate.Count == 0)
|
||||
{
|
||||
if (!silentUpdate)
|
||||
{
|
||||
API.ShowMsg(API.GetTranslation("updateNoResultTitle"), API.GetTranslation("updateNoResultSubtitle"));
|
||||
API.ShowMsg(Localize.updateNoResultTitle(), Localize.updateNoResultSubtitle());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -331,8 +315,8 @@ public static class PluginInstaller
|
|||
|
||||
// Show message box with button to update all plugins
|
||||
API.ShowMsgWithButton(
|
||||
API.GetTranslation("updateAllPluginsTitle"),
|
||||
API.GetTranslation("updateAllPluginsButtonContent"),
|
||||
Localize.updateAllPluginsTitle(),
|
||||
Localize.updateAllPluginsButtonContent(),
|
||||
() =>
|
||||
{
|
||||
updateAllPlugins(resultsForUpdate);
|
||||
|
|
@ -357,7 +341,7 @@ public static class PluginInstaller
|
|||
using var cts = new CancellationTokenSource();
|
||||
|
||||
await DownloadFileAsync(
|
||||
$"{API.GetTranslation("DownloadingPlugin")} {plugin.PluginNewUserPlugin.Name}",
|
||||
$"{Localize.DownloadingPlugin()} {plugin.PluginNewUserPlugin.Name}",
|
||||
plugin.PluginNewUserPlugin.UrlDownload, downloadToFilePath, cts);
|
||||
|
||||
// check if user cancelled download before installing plugin
|
||||
|
|
@ -376,7 +360,7 @@ public static class PluginInstaller
|
|||
catch (Exception e)
|
||||
{
|
||||
API.LogException(ClassName, "Failed to update plugin", e);
|
||||
API.ShowMsgError(API.GetTranslation("ErrorUpdatingPlugin"));
|
||||
API.ShowMsgError(Localize.ErrorUpdatingPlugin());
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
@ -389,8 +373,8 @@ public static class PluginInstaller
|
|||
else
|
||||
{
|
||||
API.ShowMsg(
|
||||
API.GetTranslation("updatebtn"),
|
||||
API.GetTranslation("PluginsUpdateSuccessNoRestart"));
|
||||
Localize.updatebtn(),
|
||||
Localize.PluginsUpdateSuccessNoRestart());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
@ -295,15 +295,12 @@ namespace Flow.Launcher.Core.Plugin
|
|||
}
|
||||
}
|
||||
|
||||
if (failedPlugins.Any())
|
||||
if (!failedPlugins.IsEmpty)
|
||||
{
|
||||
var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name));
|
||||
API.ShowMsg(
|
||||
API.GetTranslation("failedToInitializePluginsTitle"),
|
||||
string.Format(
|
||||
API.GetTranslation("failedToInitializePluginsMessage"),
|
||||
failed
|
||||
),
|
||||
Localize.failedToInitializePluginsTitle(),
|
||||
Localize.failedToInitializePluginsMessage(failed),
|
||||
"",
|
||||
false
|
||||
);
|
||||
|
|
@ -636,8 +633,8 @@ namespace Flow.Launcher.Core.Plugin
|
|||
{
|
||||
if (PluginModified(existingVersion.ID))
|
||||
{
|
||||
API.ShowMsgError(string.Format(API.GetTranslation("pluginModifiedAlreadyTitle"), existingVersion.Name),
|
||||
API.GetTranslation("pluginModifiedAlreadyMessage"));
|
||||
API.ShowMsgError(Localize.pluginModifiedAlreadyTitle(existingVersion.Name),
|
||||
Localize.pluginModifiedAlreadyMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -669,8 +666,8 @@ namespace Flow.Launcher.Core.Plugin
|
|||
{
|
||||
if (checkModified && PluginModified(plugin.ID))
|
||||
{
|
||||
API.ShowMsgError(string.Format(API.GetTranslation("pluginModifiedAlreadyTitle"), plugin.Name),
|
||||
API.GetTranslation("pluginModifiedAlreadyMessage"));
|
||||
API.ShowMsgError(Localize.pluginModifiedAlreadyTitle(plugin.Name),
|
||||
Localize.pluginModifiedAlreadyMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -689,15 +686,15 @@ namespace Flow.Launcher.Core.Plugin
|
|||
|
||||
if (string.IsNullOrEmpty(metadataJsonFilePath) || string.IsNullOrEmpty(pluginFolderPath))
|
||||
{
|
||||
API.ShowMsgError(string.Format(API.GetTranslation("failedToInstallPluginTitle"), plugin.Name),
|
||||
string.Format(API.GetTranslation("fileNotFoundMessage"), pluginFolderPath));
|
||||
API.ShowMsgError(Localize.failedToInstallPluginTitle(plugin.Name),
|
||||
Localize.fileNotFoundMessage(pluginFolderPath));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (SameOrLesserPluginVersionExists(metadataJsonFilePath))
|
||||
{
|
||||
API.ShowMsgError(string.Format(API.GetTranslation("failedToInstallPluginTitle"), plugin.Name),
|
||||
API.GetTranslation("pluginExistAlreadyMessage"));
|
||||
API.ShowMsgError(Localize.failedToInstallPluginTitle(plugin.Name),
|
||||
Localize.pluginExistAlreadyMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -750,8 +747,8 @@ namespace Flow.Launcher.Core.Plugin
|
|||
{
|
||||
if (checkModified && PluginModified(plugin.ID))
|
||||
{
|
||||
API.ShowMsgError(string.Format(API.GetTranslation("pluginModifiedAlreadyTitle"), plugin.Name),
|
||||
API.GetTranslation("pluginModifiedAlreadyMessage"));
|
||||
API.ShowMsgError(Localize.pluginModifiedAlreadyTitle(plugin.Name),
|
||||
Localize.pluginModifiedAlreadyMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -785,8 +782,8 @@ namespace Flow.Launcher.Core.Plugin
|
|||
catch (Exception e)
|
||||
{
|
||||
API.LogException(ClassName, $"Failed to delete plugin settings folder for {plugin.Name}", e);
|
||||
API.ShowMsgError(API.GetTranslation("failedToRemovePluginSettingsTitle"),
|
||||
string.Format(API.GetTranslation("failedToRemovePluginSettingsMessage"), plugin.Name));
|
||||
API.ShowMsgError(Localize.failedToRemovePluginSettingsTitle(),
|
||||
Localize.failedToRemovePluginSettingsMessage(plugin.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -801,8 +798,8 @@ namespace Flow.Launcher.Core.Plugin
|
|||
catch (Exception e)
|
||||
{
|
||||
API.LogException(ClassName, $"Failed to delete plugin cache folder for {plugin.Name}", e);
|
||||
API.ShowMsgError(API.GetTranslation("failedToRemovePluginCacheTitle"),
|
||||
string.Format(API.GetTranslation("failedToRemovePluginCacheMessage"), plugin.Name));
|
||||
API.ShowMsgError(Localize.failedToRemovePluginCacheTitle(),
|
||||
Localize.failedToRemovePluginCacheMessage(plugin.Name));
|
||||
}
|
||||
Settings.RemovePluginSettings(plugin.ID);
|
||||
AllPlugins.RemoveAll(p => p.Metadata.ID == plugin.ID);
|
||||
|
|
|
|||
|
|
@ -121,12 +121,12 @@ namespace Flow.Launcher.Core.Plugin
|
|||
var errorPluginString = string.Join(Environment.NewLine, erroredPlugins);
|
||||
|
||||
var errorMessage = erroredPlugins.Count > 1 ?
|
||||
API.GetTranslation("pluginsHaveErrored") :
|
||||
API.GetTranslation("pluginHasErrored");
|
||||
Localize.pluginsHaveErrored():
|
||||
Localize.pluginHasErrored();
|
||||
|
||||
API.ShowMsgError($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" +
|
||||
$"{errorPluginString}{Environment.NewLine}{Environment.NewLine}" +
|
||||
API.GetTranslation("referToLogs"));
|
||||
Localize.referToLogs());
|
||||
}
|
||||
|
||||
return plugins;
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
_api.LogError(ClassName, $"Theme <{theme}> path can't be found");
|
||||
if (theme != Constant.DefaultTheme)
|
||||
{
|
||||
_api.ShowMsgBox(string.Format(_api.GetTranslation("theme_load_failure_path_not_exists"), theme));
|
||||
_api.ShowMsgBox(Localize.theme_load_failure_path_not_exists(theme));
|
||||
ChangeTheme(Constant.DefaultTheme);
|
||||
}
|
||||
return false;
|
||||
|
|
@ -454,7 +454,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
_api.LogError(ClassName, $"Theme <{theme}> fail to parse");
|
||||
if (theme != Constant.DefaultTheme)
|
||||
{
|
||||
_api.ShowMsgBox(string.Format(_api.GetTranslation("theme_load_failure_parse_error"), theme));
|
||||
_api.ShowMsgBox(Localize.theme_load_failure_parse_error(theme));
|
||||
ChangeTheme(Constant.DefaultTheme);
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ namespace Flow.Launcher.Core
|
|||
try
|
||||
{
|
||||
if (!silentUpdate)
|
||||
_api.ShowMsg(_api.GetTranslation("pleaseWait"),
|
||||
_api.GetTranslation("update_flowlauncher_update_check"));
|
||||
_api.ShowMsg(Localize.pleaseWait(),
|
||||
Localize.update_flowlauncher_update_check());
|
||||
|
||||
using var updateManager = await GitHubUpdateManagerAsync(GitHubRepository).ConfigureAwait(false);
|
||||
|
||||
|
|
@ -58,13 +58,13 @@ namespace Flow.Launcher.Core
|
|||
if (newReleaseVersion <= currentVersion)
|
||||
{
|
||||
if (!silentUpdate)
|
||||
_api.ShowMsgBox(_api.GetTranslation("update_flowlauncher_already_on_latest"));
|
||||
_api.ShowMsgBox(Localize.update_flowlauncher_already_on_latest());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!silentUpdate)
|
||||
_api.ShowMsg(_api.GetTranslation("update_flowlauncher_update_found"),
|
||||
_api.GetTranslation("update_flowlauncher_updating"));
|
||||
_api.ShowMsg(Localize.update_flowlauncher_update_found(),
|
||||
Localize.update_flowlauncher_updating());
|
||||
|
||||
await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply).ConfigureAwait(false);
|
||||
|
||||
|
|
@ -77,10 +77,7 @@ namespace Flow.Launcher.Core
|
|||
FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination, (s) => _api.ShowMsgBox(s));
|
||||
if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination,
|
||||
(s) => _api.ShowMsgBox(s)))
|
||||
_api.ShowMsgBox(string.Format(
|
||||
_api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"),
|
||||
DataLocation.PortableDataPath,
|
||||
targetDestination));
|
||||
_api.ShowMsgBox(Localize.update_flowlauncher_fail_moving_portable_user_profile_data(DataLocation.PortableDataPath, targetDestination));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -91,7 +88,7 @@ namespace Flow.Launcher.Core
|
|||
|
||||
_api.LogInfo(ClassName, $"Update success:{newVersionTips}");
|
||||
|
||||
if (_api.ShowMsgBox(newVersionTips, _api.GetTranslation("update_flowlauncher_new_update"),
|
||||
if (_api.ShowMsgBox(newVersionTips, Localize.update_flowlauncher_new_update(),
|
||||
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
UpdateManager.RestartApp(Constant.ApplicationFileName);
|
||||
|
|
@ -111,8 +108,8 @@ namespace Flow.Launcher.Core
|
|||
}
|
||||
|
||||
if (!silentUpdate)
|
||||
_api.ShowMsgError(_api.GetTranslation("update_flowlauncher_fail"),
|
||||
_api.GetTranslation("update_flowlauncher_check_connection"));
|
||||
_api.ShowMsgError(Localize.update_flowlauncher_fail(),
|
||||
Localize.update_flowlauncher_check_connection());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -150,9 +147,9 @@ namespace Flow.Launcher.Core
|
|||
return manager;
|
||||
}
|
||||
|
||||
private string NewVersionTips(string version)
|
||||
private static string NewVersionTips(string version)
|
||||
{
|
||||
var tips = string.Format(_api.GetTranslation("newVersionTips"), version);
|
||||
var tips = Localize.newVersionTips(version);
|
||||
|
||||
return tips;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,12 @@
|
|||
"YamlDotNet": "9.1.0"
|
||||
}
|
||||
},
|
||||
"Flow.Launcher.Localization": {
|
||||
"type": "Direct",
|
||||
"requested": "[0.0.6, )",
|
||||
"resolved": "0.0.6",
|
||||
"contentHash": "Wwh5lrnmAf66go456h9sSrkdIW3G/IaKPE3+qWZLRAQ86kIe1JovHRj+ljHZXnFOWu1cbFmHg3l1RuqzPLAHow=="
|
||||
},
|
||||
"FSharp.Core": {
|
||||
"type": "Direct",
|
||||
"requested": "[9.0.303, )",
|
||||
|
|
@ -254,6 +260,7 @@
|
|||
"Ben.Demystifier": "[0.4.1, )",
|
||||
"BitFaster.Caching": "[2.5.4, )",
|
||||
"CommunityToolkit.Mvvm": "[8.4.0, )",
|
||||
"Flow.Launcher.Localization": "[0.0.6, )",
|
||||
"Flow.Launcher.Plugin": "[5.0.0, )",
|
||||
"InputSimulator": "[1.0.4, )",
|
||||
"MemoryPack": "[1.21.4, )",
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<NoWarn>$(NoWarn);FLSG0007</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -56,6 +57,7 @@
|
|||
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
|
||||
<PackageReference Include="BitFaster.Caching" Version="2.5.4" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.6" />
|
||||
<PackageReference Include="Fody" Version="6.9.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
|
@ -80,4 +82,15 @@
|
|||
<PackageReference Include="ToolGood.Words.Pinyin" Version="3.1.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<FLLUseDependencyInjection>true</FLLUseDependencyInjection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Remove="Languages\en.xaml" />
|
||||
<AdditionalFiles Include="..\Flow.Launcher\Languages\en.xaml">
|
||||
<Link>Languages\en.xaml</Link>
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -82,7 +82,7 @@ namespace Flow.Launcher.Infrastructure.Http
|
|||
}
|
||||
catch (UriFormatException e)
|
||||
{
|
||||
API.ShowMsgError(API.GetTranslation("pleaseTryAgain"), API.GetTranslation("parseProxyFailed"));
|
||||
API.ShowMsgError(Localize.pleaseTryAgain(), Localize.parseProxyFailed());
|
||||
Log.Exception(ClassName, "Unable to parse Uri", e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.UserSettings
|
||||
{
|
||||
public class CustomBrowserViewModel : BaseModel
|
||||
{
|
||||
// We should not initialize API in static constructor because it will create another API instance
|
||||
private static IPublicAPI api = null;
|
||||
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
|
||||
|
||||
public string Name { get; set; }
|
||||
[JsonIgnore]
|
||||
public string DisplayName => Name == "Default" ? API.GetTranslation("defaultBrowser_default") : Name;
|
||||
public string DisplayName => Name == "Default" ? Localize.defaultBrowser_default(): Name;
|
||||
public string Path { get; set; }
|
||||
public string PrivateArg { get; set; }
|
||||
public bool EnablePrivate { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Flow.Launcher.Plugin;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.UserSettings
|
||||
{
|
||||
public class CustomExplorerViewModel : BaseModel
|
||||
{
|
||||
// We should not initialize API in static constructor because it will create another API instance
|
||||
private static IPublicAPI api = null;
|
||||
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
|
||||
|
||||
public string Name { get; set; }
|
||||
[JsonIgnore]
|
||||
public string DisplayName => Name == "Explorer" ? API.GetTranslation("fileManagerExplorer") : Name;
|
||||
public string DisplayName => Name == "Explorer" ? Localize.fileManagerExplorer(): Name;
|
||||
public string Path { get; set; }
|
||||
public string FileArgument { get; set; } = "\"%d\"";
|
||||
public string DirectoryArgument { get; set; } = "\"%d\"";
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@
|
|||
"resolved": "8.4.0",
|
||||
"contentHash": "tqVU8yc/ADO9oiTRyTnwhFN68hCwvkliMierptWOudIAvWY1mWCh5VFh+guwHJmpMwfg0J0rY+yyd5Oy7ty9Uw=="
|
||||
},
|
||||
"Flow.Launcher.Localization": {
|
||||
"type": "Direct",
|
||||
"requested": "[0.0.6, )",
|
||||
"resolved": "0.0.6",
|
||||
"contentHash": "Wwh5lrnmAf66go456h9sSrkdIW3G/IaKPE3+qWZLRAQ86kIe1JovHRj+ljHZXnFOWu1cbFmHg3l1RuqzPLAHow=="
|
||||
},
|
||||
"Fody": {
|
||||
"type": "Direct",
|
||||
"requested": "[6.9.3, )",
|
||||
|
|
|
|||
|
|
@ -846,6 +846,7 @@
|
|||
"Droplex": "[1.7.0, )",
|
||||
"FSharp.Core": "[9.0.303, )",
|
||||
"Flow.Launcher.Infrastructure": "[1.0.0, )",
|
||||
"Flow.Launcher.Localization": "[0.0.6, )",
|
||||
"Flow.Launcher.Plugin": "[5.0.0, )",
|
||||
"Meziantou.Framework.Win32.Jobs": "[3.4.4, )",
|
||||
"Microsoft.IO.RecyclableMemoryStream": "[3.0.1, )",
|
||||
|
|
@ -860,6 +861,7 @@
|
|||
"Ben.Demystifier": "[0.4.1, )",
|
||||
"BitFaster.Caching": "[2.5.4, )",
|
||||
"CommunityToolkit.Mvvm": "[8.4.0, )",
|
||||
"Flow.Launcher.Localization": "[0.0.6, )",
|
||||
"Flow.Launcher.Plugin": "[5.0.0, )",
|
||||
"InputSimulator": "[1.0.4, )",
|
||||
"MemoryPack": "[1.21.4, )",
|
||||
|
|
|
|||
Loading…
Reference in a new issue