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
4865224458
commit
d87650de08
25 changed files with 134 additions and 143 deletions
|
|
@ -47,7 +47,7 @@ namespace Flow.Launcher
|
|||
|
||||
if (addedActionKeywords.Any(App.API.ActionKeywordAssigned))
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("newActionKeywordsHasBeenAssigned"));
|
||||
App.API.ShowMsgBox(Localize.newActionKeywordsHasBeenAssigned());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ namespace Flow.Launcher
|
|||
if (sortedOldActionKeywords.SequenceEqual(sortedNewActionKeywords))
|
||||
{
|
||||
// User just changes the sequence of action keywords
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("newActionKeywordsSameAsOld"));
|
||||
App.API.ShowMsgBox(Localize.newActionKeywordsSameAsOld());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ namespace Flow.Launcher
|
|||
// but if it fails (permissions, etc) then don't keep retrying
|
||||
// this also gives the user a visual indication in the Settings widget
|
||||
_settings.StartFlowLauncherOnSystemStartup = false;
|
||||
API.ShowMsgError(API.GetTranslation("setAutoStartFailed"), e.Message);
|
||||
API.ShowMsgError(Localize.setAutoStartFailed(), e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace Flow.Launcher
|
|||
|
||||
if (string.IsNullOrEmpty(Hotkey) && string.IsNullOrEmpty(ActionKeyword))
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("emptyPluginHotkey"));
|
||||
App.API.ShowMsgBox(Localize.emptyPluginHotkey());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ namespace Flow.Launcher
|
|||
{
|
||||
if (string.IsNullOrEmpty(Key) || string.IsNullOrEmpty(Value))
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("emptyShortcut"));
|
||||
App.API.ShowMsgBox(Localize.emptyShortcut());
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if key is modified or adding a new one
|
||||
if (((update && originalKey != Key) || !update) && _hotkeyVm.DoesShortcutExist(Key))
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("duplicateShortcut"));
|
||||
App.API.ShowMsgBox(Localize.duplicateShortcut());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<NoWarn>$(NoWarn);FLSG0007</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="RemoveUnnecessaryRuntimesAfterBuild" AfterTargets="Build">
|
||||
|
|
@ -132,6 +133,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="ChefKeys" Version="0.1.2" />
|
||||
<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>
|
||||
|
|
@ -161,6 +163,10 @@
|
|||
<ProjectReference Include="..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<FLLUseDependencyInjection>true</FLLUseDependencyInjection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\open.wav">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ internal static class HotKeyMapper
|
|||
string.Format("|HotkeyMapper.SetWithChefKeys|Error registering hotkey: {0} \nStackTrace:{1}",
|
||||
e.Message,
|
||||
e.StackTrace));
|
||||
string errorMsg = string.Format(App.API.GetTranslation("registerHotkeyFailed"), hotkeyStr);
|
||||
string errorMsgTitle = App.API.GetTranslation("MessageBoxTitle");
|
||||
string errorMsg = Localize.registerHotkeyFailed(hotkeyStr);
|
||||
string errorMsgTitle = Localize.MessageBoxTitle();
|
||||
App.API.ShowMsgBox(errorMsg, errorMsgTitle);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,8 +87,8 @@ internal static class HotKeyMapper
|
|||
e.Message,
|
||||
e.StackTrace,
|
||||
hotkeyStr));
|
||||
string errorMsg = string.Format(App.API.GetTranslation("registerHotkeyFailed"), hotkeyStr);
|
||||
string errorMsgTitle = App.API.GetTranslation("MessageBoxTitle");
|
||||
string errorMsg = Localize.registerHotkeyFailed(hotkeyStr);
|
||||
string errorMsgTitle = Localize.MessageBoxTitle();
|
||||
App.API.ShowMsgBox(errorMsg, errorMsgTitle);
|
||||
}
|
||||
}
|
||||
|
|
@ -112,8 +112,8 @@ internal static class HotKeyMapper
|
|||
string.Format("|HotkeyMapper.RemoveHotkey|Error removing hotkey: {0} \nStackTrace:{1}",
|
||||
e.Message,
|
||||
e.StackTrace));
|
||||
string errorMsg = string.Format(App.API.GetTranslation("unregisterHotkeyFailed"), hotkeyStr);
|
||||
string errorMsgTitle = App.API.GetTranslation("MessageBoxTitle");
|
||||
string errorMsg = Localize.unregisterHotkeyFailed(hotkeyStr);
|
||||
string errorMsgTitle = Localize.MessageBoxTitle();
|
||||
App.API.ShowMsgBox(errorMsg, errorMsgTitle);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
|
@ -234,7 +234,7 @@ namespace Flow.Launcher
|
|||
private static bool CheckHotkeyAvailability(HotkeyModel hotkey, bool validateKeyGesture) =>
|
||||
hotkey.Validate(validateKeyGesture) && HotKeyMapper.CheckAvailability(hotkey);
|
||||
|
||||
public string EmptyHotkey => App.API.GetTranslation("none");
|
||||
public string EmptyHotkey => Localize.none();
|
||||
|
||||
public ObservableCollection<string> KeysToDisplay { get; set; } = new();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public partial class HotkeyControlDialog : ContentDialog
|
|||
|
||||
public EResultType ResultType { get; private set; } = EResultType.Cancel;
|
||||
public string ResultValue { get; private set; } = string.Empty;
|
||||
public static string EmptyHotkey => App.API.GetTranslation("none");
|
||||
public static string EmptyHotkey => Localize.none();
|
||||
|
||||
private static bool isOpenFlowHotkey;
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ public partial class HotkeyControlDialog : ContentDialog
|
|||
{
|
||||
WindowTitle = windowTitle switch
|
||||
{
|
||||
"" or null => App.API.GetTranslation("hotkeyRegTitle"),
|
||||
"" or null => Localize.hotkeyRegTitle(),
|
||||
_ => windowTitle
|
||||
};
|
||||
DefaultHotkey = defaultHotkey;
|
||||
|
|
@ -146,10 +146,7 @@ public partial class HotkeyControlDialog : ContentDialog
|
|||
Alert.Visibility = Visibility.Visible;
|
||||
if (registeredHotkeyData.RemoveHotkey is not null)
|
||||
{
|
||||
tbMsg.Text = string.Format(
|
||||
App.API.GetTranslation("hotkeyUnavailableEditable"),
|
||||
description
|
||||
);
|
||||
tbMsg.Text = Localize.hotkeyUnavailableEditable(description);
|
||||
SaveBtn.IsEnabled = false;
|
||||
SaveBtn.Visibility = Visibility.Collapsed;
|
||||
OverwriteBtn.IsEnabled = true;
|
||||
|
|
@ -158,10 +155,7 @@ public partial class HotkeyControlDialog : ContentDialog
|
|||
}
|
||||
else
|
||||
{
|
||||
tbMsg.Text = string.Format(
|
||||
App.API.GetTranslation("hotkeyUnavailableUneditable"),
|
||||
description
|
||||
);
|
||||
tbMsg.Text = Localize.hotkeyUnavailableUneditable(description);
|
||||
SaveBtn.IsEnabled = false;
|
||||
SaveBtn.Visibility = Visibility.Visible;
|
||||
OverwriteBtn.IsEnabled = false;
|
||||
|
|
@ -175,7 +169,7 @@ public partial class HotkeyControlDialog : ContentDialog
|
|||
|
||||
if (!CheckHotkeyAvailability(hotkey.Value, true))
|
||||
{
|
||||
tbMsg.Text = App.API.GetTranslation("hotkeyUnavailable");
|
||||
tbMsg.Text = Localize.hotkeyUnavailable();
|
||||
Alert.Visibility = Visibility.Visible;
|
||||
SaveBtn.IsEnabled = false;
|
||||
SaveBtn.Visibility = Visibility.Visible;
|
||||
|
|
|
|||
|
|
@ -209,6 +209,8 @@
|
|||
<system:String x:Key="plugin_query_version">Version</system:String>
|
||||
<system:String x:Key="plugin_query_web">Website</system:String>
|
||||
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
|
||||
<system:String x:Key="plugin_default_search_delay_time">Search delay time: default</system:String>
|
||||
<system:String x:Key="plugin_search_delay_time">Search delay time: {0}ms</system:String>
|
||||
<system:String x:Key="failedToRemovePluginSettingsTitle">Fail to remove plugin settings</system:String>
|
||||
<system:String x:Key="failedToRemovePluginSettingsMessage">Plugins: {0} - Fail to remove plugin settings files, please remove them manually</system:String>
|
||||
<system:String x:Key="failedToRemovePluginCacheTitle">Fail to remove plugin cache</system:String>
|
||||
|
|
@ -588,7 +590,7 @@
|
|||
The specified file manager could not be found. Please check the Custom File Manager setting under Settings > General.
|
||||
</system:String>
|
||||
<system:String x:Key="errorTitle">Error</system:String>
|
||||
<system:String x:Key="folderOpenError">An error occurred while opening the folder. {0}</system:String>
|
||||
<system:String x:Key="folderOpenError">An error occurred while opening the folder.</system:String>
|
||||
<system:String x:Key="browserOpenError">An error occurred while opening the URL in the browser. Please check your Default Web Browser configuration in the General section of the settings window</system:String>
|
||||
<system:String x:Key="fileNotFoundError">File or directory not found: {0}</system:String>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
|
|
@ -145,8 +145,8 @@ namespace Flow.Launcher
|
|||
_settings.ReleaseNotesVersion = Constant.Version;
|
||||
// Show release note popup with button
|
||||
App.API.ShowMsgWithButton(
|
||||
string.Format(App.API.GetTranslation("appUpdateTitle"), Constant.Version),
|
||||
App.API.GetTranslation("appUpdateButtonContent"),
|
||||
Localize.appUpdateTitle(Constant.Version),
|
||||
Localize.appUpdateButtonContent(),
|
||||
() =>
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
|
|
@ -753,12 +753,12 @@ namespace Flow.Launcher
|
|||
private void UpdateNotifyIconText()
|
||||
{
|
||||
var menu = _contextMenu;
|
||||
((MenuItem)menu.Items[0]).Header = App.API.GetTranslation("iconTrayOpen") +
|
||||
((MenuItem)menu.Items[0]).Header = Localize.iconTrayOpen()+
|
||||
" (" + _settings.Hotkey + ")";
|
||||
((MenuItem)menu.Items[1]).Header = App.API.GetTranslation("GameMode");
|
||||
((MenuItem)menu.Items[2]).Header = App.API.GetTranslation("PositionReset");
|
||||
((MenuItem)menu.Items[3]).Header = App.API.GetTranslation("iconTraySettings");
|
||||
((MenuItem)menu.Items[4]).Header = App.API.GetTranslation("iconTrayExit");
|
||||
((MenuItem)menu.Items[1]).Header = Localize.GameMode();
|
||||
((MenuItem)menu.Items[2]).Header = Localize.PositionReset();
|
||||
((MenuItem)menu.Items[3]).Header = Localize.iconTraySettings();
|
||||
((MenuItem)menu.Items[4]).Header = Localize.iconTrayExit();
|
||||
}
|
||||
|
||||
private void InitializeContextMenu()
|
||||
|
|
@ -768,31 +768,31 @@ namespace Flow.Launcher
|
|||
var openIcon = new FontIcon { Glyph = "\ue71e" };
|
||||
var open = new MenuItem
|
||||
{
|
||||
Header = App.API.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")",
|
||||
Header = Localize.iconTrayOpen()+ " (" + _settings.Hotkey + ")",
|
||||
Icon = openIcon
|
||||
};
|
||||
var gamemodeIcon = new FontIcon { Glyph = "\ue7fc" };
|
||||
var gamemode = new MenuItem
|
||||
{
|
||||
Header = App.API.GetTranslation("GameMode"),
|
||||
Header = Localize.GameMode(),
|
||||
Icon = gamemodeIcon
|
||||
};
|
||||
var positionresetIcon = new FontIcon { Glyph = "\ue73f" };
|
||||
var positionreset = new MenuItem
|
||||
{
|
||||
Header = App.API.GetTranslation("PositionReset"),
|
||||
Header = Localize.PositionReset(),
|
||||
Icon = positionresetIcon
|
||||
};
|
||||
var settingsIcon = new FontIcon { Glyph = "\ue713" };
|
||||
var settings = new MenuItem
|
||||
{
|
||||
Header = App.API.GetTranslation("iconTraySettings"),
|
||||
Header = Localize.iconTraySettings(),
|
||||
Icon = settingsIcon
|
||||
};
|
||||
var exitIcon = new FontIcon { Glyph = "\ue7e8" };
|
||||
var exit = new MenuItem
|
||||
{
|
||||
Header = App.API.GetTranslation("iconTrayExit"),
|
||||
Header = Localize.iconTrayExit(),
|
||||
Icon = exitIcon
|
||||
};
|
||||
|
||||
|
|
@ -802,8 +802,8 @@ namespace Flow.Launcher
|
|||
settings.Click += (o, e) => App.API.OpenSettingDialog();
|
||||
exit.Click += (o, e) => Close();
|
||||
|
||||
gamemode.ToolTip = App.API.GetTranslation("GameModeToolTip");
|
||||
positionreset.ToolTip = App.API.GetTranslation("PositionResetToolTip");
|
||||
gamemode.ToolTip = Localize.GameModeToolTip();
|
||||
positionreset.ToolTip = Localize.PositionResetToolTip();
|
||||
|
||||
_contextMenu.Items.Add(open);
|
||||
_contextMenu.Items.Add(gamemode);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Flow.Launcher
|
|||
{
|
||||
var checkBox = new CheckBox
|
||||
{
|
||||
Content = string.Format(App.API.GetTranslation("updatePluginCheckboxContent"), plugin.Name, plugin.CurrentVersion, plugin.NewVersion),
|
||||
Content = Localize.updatePluginCheckboxContent(plugin.Name, plugin.CurrentVersion, plugin.NewVersion),
|
||||
IsChecked = true,
|
||||
Margin = new Thickness(0, 5, 0, 5),
|
||||
Tag = plugin,
|
||||
|
|
@ -50,10 +50,7 @@ namespace Flow.Launcher
|
|||
{
|
||||
if (sender is not CheckBox cb) return;
|
||||
if (cb.Tag is not PluginUpdateInfo plugin) return;
|
||||
if (Plugins.Contains(plugin))
|
||||
{
|
||||
Plugins.Remove(plugin);
|
||||
}
|
||||
Plugins.Remove(plugin);
|
||||
}
|
||||
|
||||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
||||
|
|
@ -66,7 +63,7 @@ namespace Flow.Launcher
|
|||
{
|
||||
if (Plugins.Count == 0)
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("updatePluginNoSelected"));
|
||||
App.API.ShowMsgBox(Localize.updatePluginNoSelected());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,14 +184,14 @@ namespace Flow.Launcher
|
|||
if (showDefaultNotification)
|
||||
{
|
||||
ShowMsg(
|
||||
$"{GetTranslation("copy")} {(isFile ? GetTranslation("fileTitle") : GetTranslation("folderTitle"))}",
|
||||
GetTranslation("completedSuccessfully"));
|
||||
$"{Localize.copy()} {(isFile ? Localize.fileTitle(): Localize.folderTitle())}",
|
||||
Localize.completedSuccessfully());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogException(nameof(PublicAPIInstance), "Failed to copy file/folder to clipboard", exception);
|
||||
ShowMsgError(GetTranslation("failedToCopy"));
|
||||
ShowMsgError(Localize.failedToCopy());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -209,14 +209,14 @@ namespace Flow.Launcher
|
|||
if (showDefaultNotification)
|
||||
{
|
||||
ShowMsg(
|
||||
$"{GetTranslation("copy")} {GetTranslation("textTitle")}",
|
||||
GetTranslation("completedSuccessfully"));
|
||||
$"{Localize.copy()} {Localize.textTitle()}",
|
||||
Localize.completedSuccessfully());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogException(nameof(PublicAPIInstance), "Failed to copy text to clipboard", exception);
|
||||
ShowMsgError(GetTranslation("failedToCopy"));
|
||||
ShowMsgError(Localize.failedToCopy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -393,18 +393,18 @@ namespace Flow.Launcher
|
|||
}
|
||||
catch (Win32Exception ex) when (ex.NativeErrorCode == 2)
|
||||
{
|
||||
LogError(ClassName, "File Manager not found");
|
||||
LogException(ClassName, "File Manager not found", ex);
|
||||
ShowMsgError(
|
||||
GetTranslation("fileManagerNotFoundTitle"),
|
||||
string.Format(GetTranslation("fileManagerNotFound"), ex.Message)
|
||||
Localize.fileManagerNotFoundTitle(),
|
||||
Localize.fileManagerNotFound()
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogException(ClassName, "Failed to open folder", ex);
|
||||
ShowMsgError(
|
||||
GetTranslation("errorTitle"),
|
||||
string.Format(GetTranslation("folderOpenError"), ex.Message)
|
||||
Localize.errorTitle(),
|
||||
Localize.folderOpenError()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +413,7 @@ namespace Flow.Launcher
|
|||
{
|
||||
if (uri.IsFile && !FilesFolders.FileOrLocationExists(uri.LocalPath))
|
||||
{
|
||||
ShowMsgError(GetTranslation("errorTitle"), string.Format(GetTranslation("fileNotFoundError"), uri.LocalPath));
|
||||
ShowMsgError(Localize.errorTitle(), Localize.fileNotFoundError(uri.LocalPath));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -439,8 +439,8 @@ namespace Flow.Launcher
|
|||
var tabOrWindow = browserInfo.OpenInTab ? "tab" : "window";
|
||||
LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}", e);
|
||||
ShowMsgError(
|
||||
GetTranslation("errorTitle"),
|
||||
GetTranslation("browserOpenError")
|
||||
Localize.errorTitle(),
|
||||
Localize.browserOpenError()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -457,7 +457,7 @@ namespace Flow.Launcher
|
|||
catch (Exception e)
|
||||
{
|
||||
LogException(ClassName, $"Failed to open: {uri.AbsoluteUri}", e);
|
||||
ShowMsgError(GetTranslation("errorTitle"), e.Message);
|
||||
ShowMsgError(Localize.errorTitle(), e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,8 +132,8 @@ namespace Flow.Launcher
|
|||
RefreshButton.Visibility = Visibility.Visible;
|
||||
MarkdownViewer.Visibility = Visibility.Collapsed;
|
||||
App.API.ShowMsgError(
|
||||
App.API.GetTranslation("checkNetworkConnectionTitle"),
|
||||
App.API.GetTranslation("checkNetworkConnectionSubTitle"));
|
||||
Localize.checkNetworkConnectionTitle(),
|
||||
Localize.checkNetworkConnectionSubTitle());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ namespace Flow.Launcher
|
|||
_ => Constant.IssuesUrl
|
||||
};
|
||||
|
||||
var paragraph = Hyperlink(App.API.GetTranslation("reportWindow_please_open_issue"), websiteUrl);
|
||||
paragraph.Inlines.Add(string.Format(App.API.GetTranslation("reportWindow_upload_log"), log.FullName));
|
||||
var paragraph = Hyperlink(Localize.reportWindow_please_open_issue(), websiteUrl);
|
||||
paragraph.Inlines.Add(Localize.reportWindow_upload_log(log.FullName));
|
||||
paragraph.Inlines.Add("\n");
|
||||
paragraph.Inlines.Add(App.API.GetTranslation("reportWindow_copy_below"));
|
||||
paragraph.Inlines.Add(Localize.reportWindow_copy_below());
|
||||
ErrorTextbox.Document.Blocks.Add(paragraph);
|
||||
|
||||
StringBuilder content = new StringBuilder();
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace Flow.Launcher.Resources.Pages
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
App.API.ShowMsgError(App.API.GetTranslation("setAutoStartFailed"), e.Message);
|
||||
App.API.ShowMsgError(Localize.setAutoStartFailed(), e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
get
|
||||
{
|
||||
var size = GetLogFiles().Sum(file => file.Length);
|
||||
return $"{App.API.GetTranslation("clearlogfolder")} ({BytesToReadableString(size)})";
|
||||
return $"{Localize.clearlogfolder()} ({BytesToReadableString(size)})";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
get
|
||||
{
|
||||
var size = GetCacheFiles().Sum(file => file.Length);
|
||||
return $"{App.API.GetTranslation("clearcachefolder")} ({BytesToReadableString(size)})";
|
||||
return $"{Localize.clearcachefolder()} ({BytesToReadableString(size)})";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -51,10 +51,7 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
_ => Constant.Version
|
||||
};
|
||||
|
||||
public string ActivatedTimes => string.Format(
|
||||
App.API.GetTranslation("about_activate_times"),
|
||||
_settings.ActivateTimes
|
||||
);
|
||||
public string ActivatedTimes => Localize.about_activate_times(_settings.ActivateTimes);
|
||||
|
||||
public class LogLevelData : DropdownDataGeneric<LOGLEVEL> { }
|
||||
|
||||
|
|
@ -98,8 +95,8 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
private void AskClearLogFolderConfirmation()
|
||||
{
|
||||
var confirmResult = App.API.ShowMsgBox(
|
||||
App.API.GetTranslation("clearlogfolderMessage"),
|
||||
App.API.GetTranslation("clearlogfolder"),
|
||||
Localize.clearlogfolderMessage(),
|
||||
Localize.clearlogfolder(),
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
|
||||
|
|
@ -107,7 +104,7 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
{
|
||||
if (!ClearLogFolder())
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("clearfolderfailMessage"));
|
||||
App.API.ShowMsgBox(Localize.clearfolderfailMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -116,8 +113,8 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
private void AskClearCacheFolderConfirmation()
|
||||
{
|
||||
var confirmResult = App.API.ShowMsgBox(
|
||||
App.API.GetTranslation("clearcachefolderMessage"),
|
||||
App.API.GetTranslation("clearcachefolder"),
|
||||
Localize.clearcachefolderMessage(),
|
||||
Localize.clearcachefolder(),
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
|
||||
|
|
@ -125,7 +122,7 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
{
|
||||
if (!ClearCacheFolder())
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("clearfolderfailMessage"));
|
||||
App.API.ShowMsgBox(Localize.clearfolderfailMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
App.API.ShowMsgError(App.API.GetTranslation("setAutoStartFailed"), e.Message);
|
||||
App.API.ShowMsgError(Localize.setAutoStartFailed(), e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
App.API.ShowMsgError(App.API.GetTranslation("setAutoStartFailed"), e.Message);
|
||||
App.API.ShowMsgError(Localize.setAutoStartFailed(), e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
else
|
||||
{
|
||||
// Since this is rarely seen text, language support is not provided.
|
||||
App.API.ShowMsgError(App.API.GetTranslation("KoreanImeSettingChangeFailTitle"), App.API.GetTranslation("KoreanImeSettingChangeFailSubTitle"));
|
||||
App.API.ShowMsgError(Localize.KoreanImeSettingChangeFailTitle(), Localize.KoreanImeSettingChangeFailSubTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -325,10 +325,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
|
||||
public string AlwaysPreviewToolTip => string.Format(
|
||||
App.API.GetTranslation("AlwaysPreviewToolTip"),
|
||||
Settings.PreviewHotkey
|
||||
);
|
||||
public string AlwaysPreviewToolTip => Localize.AlwaysPreviewToolTip(Settings.PreviewHotkey);
|
||||
|
||||
private static string GetFileFromDialog(string title, string filter = "")
|
||||
{
|
||||
|
|
@ -372,7 +369,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
private void SelectPython()
|
||||
{
|
||||
var selectedFile = GetFileFromDialog(
|
||||
App.API.GetTranslation("selectPythonExecutable"),
|
||||
Localize.selectPythonExecutable(),
|
||||
"Python|pythonw.exe"
|
||||
);
|
||||
|
||||
|
|
@ -384,7 +381,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
private void SelectNode()
|
||||
{
|
||||
var selectedFile = GetFileFromDialog(
|
||||
App.API.GetTranslation("selectNodeExecutable"),
|
||||
Localize.selectNodeExecutable(),
|
||||
"node|*.exe"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,15 +50,13 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
var item = SelectedCustomPluginHotkey;
|
||||
if (item is null)
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("pleaseSelectAnItem"));
|
||||
App.API.ShowMsgBox(Localize.pleaseSelectAnItem());
|
||||
return;
|
||||
}
|
||||
|
||||
var result = App.API.ShowMsgBox(
|
||||
string.Format(
|
||||
App.API.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey
|
||||
),
|
||||
App.API.GetTranslation("delete"),
|
||||
Localize.deleteCustomHotkeyWarning(item.Hotkey),
|
||||
Localize.delete(),
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
|
||||
|
|
@ -75,7 +73,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
var item = SelectedCustomPluginHotkey;
|
||||
if (item is null)
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("pleaseSelectAnItem"));
|
||||
App.API.ShowMsgBox(Localize.pleaseSelectAnItem());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +81,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
|
||||
if (settingItem == null)
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("invalidPluginHotkey"));
|
||||
App.API.ShowMsgBox(Localize.invalidPluginHotkey());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -114,15 +112,13 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
var item = SelectedCustomShortcut;
|
||||
if (item is null)
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("pleaseSelectAnItem"));
|
||||
App.API.ShowMsgBox(Localize.pleaseSelectAnItem());
|
||||
return;
|
||||
}
|
||||
|
||||
var result = App.API.ShowMsgBox(
|
||||
string.Format(
|
||||
App.API.GetTranslation("deleteCustomShortcutWarning"), item.Key, item.Value
|
||||
),
|
||||
App.API.GetTranslation("delete"),
|
||||
Localize.deleteCustomShortcutWarning(item.Key, item.Value),
|
||||
Localize.delete(),
|
||||
MessageBoxButton.YesNo
|
||||
);
|
||||
|
||||
|
|
@ -138,7 +134,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
var item = SelectedCustomShortcut;
|
||||
if (item is null)
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("pleaseSelectAnItem"));
|
||||
App.API.ShowMsgBox(Localize.pleaseSelectAnItem());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +142,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
o.Key == item.Key && o.Value == item.Value);
|
||||
if (settingItem == null)
|
||||
{
|
||||
App.API.ShowMsgBox(App.API.GetTranslation("invalidShortcut"));
|
||||
App.API.ShowMsgBox(Localize.invalidShortcut());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -103,8 +103,8 @@ public partial class SettingsPanePluginStoreViewModel : BaseModel
|
|||
private async Task InstallPluginAsync()
|
||||
{
|
||||
var file = GetFileFromDialog(
|
||||
App.API.GetTranslation("SelectZipFile"),
|
||||
$"{App.API.GetTranslation("ZipFiles")} (*.zip)|*.zip");
|
||||
Localize.SelectZipFile(),
|
||||
$"{Localize.ZipFiles()} (*.zip)|*.zip");
|
||||
|
||||
if (!string.IsNullOrEmpty(file))
|
||||
await PluginInstaller.InstallPluginAndCheckRestartAsync(file);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
private readonly Theme _theme;
|
||||
|
||||
private readonly string DefaultFont = Win32Helper.GetSystemDefaultFont();
|
||||
public string BackdropSubText => !Win32Helper.IsBackdropSupported() ? App.API.GetTranslation("BackdropTypeDisabledToolTip") : "";
|
||||
public string BackdropSubText => !Win32Helper.IsBackdropSupported() ? Localize.BackdropTypeDisabledToolTip(): "";
|
||||
|
||||
public static string LinkHowToCreateTheme => @"https://www.flowlauncher.com/theme-builder/";
|
||||
public static string LinkThemeGallery => "https://github.com/Flow-Launcher/Flow.Launcher/discussions/1438";
|
||||
|
|
@ -272,7 +272,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
|
||||
public string PlaceholderTextTip
|
||||
{
|
||||
get => string.Format(App.API.GetTranslation("PlaceholderTextTip"), App.API.GetTranslation("queryTextBoxPlaceholder"));
|
||||
get => Localize.PlaceholderTextTip(Localize.queryTextBoxPlaceholder());
|
||||
}
|
||||
|
||||
public string PlaceholderText
|
||||
|
|
@ -447,8 +447,8 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
{
|
||||
new()
|
||||
{
|
||||
Title = App.API.GetTranslation("SampleTitleExplorer"),
|
||||
SubTitle = App.API.GetTranslation("SampleSubTitleExplorer"),
|
||||
Title = Localize.SampleTitleExplorer(),
|
||||
SubTitle = Localize.SampleSubTitleExplorer(),
|
||||
IcoPath = Path.Combine(
|
||||
Constant.ProgramDirectory,
|
||||
@"Plugins\Flow.Launcher.Plugin.Explorer\Images\explorer.png"
|
||||
|
|
@ -456,8 +456,8 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
},
|
||||
new()
|
||||
{
|
||||
Title = App.API.GetTranslation("SampleTitleWebSearch"),
|
||||
SubTitle = App.API.GetTranslation("SampleSubTitleWebSearch"),
|
||||
Title = Localize.SampleTitleWebSearch(),
|
||||
SubTitle = Localize.SampleSubTitleWebSearch(),
|
||||
IcoPath = Path.Combine(
|
||||
Constant.ProgramDirectory,
|
||||
@"Plugins\Flow.Launcher.Plugin.WebSearch\Images\web_search.png"
|
||||
|
|
@ -465,8 +465,8 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
},
|
||||
new()
|
||||
{
|
||||
Title = App.API.GetTranslation("SampleTitleProgram"),
|
||||
SubTitle = App.API.GetTranslation("SampleSubTitleProgram"),
|
||||
Title = Localize.SampleTitleProgram(),
|
||||
SubTitle = Localize.SampleSubTitleProgram(),
|
||||
IcoPath = Path.Combine(
|
||||
Constant.ProgramDirectory,
|
||||
@"Plugins\Flow.Launcher.Plugin.Program\Images\program.png"
|
||||
|
|
@ -474,8 +474,8 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
},
|
||||
new()
|
||||
{
|
||||
Title = App.API.GetTranslation("SampleTitleProcessKiller"),
|
||||
SubTitle = App.API.GetTranslation("SampleSubTitleProcessKiller"),
|
||||
Title = Localize.SampleTitleProcessKiller(),
|
||||
SubTitle = Localize.SampleSubTitleProcessKiller(),
|
||||
IcoPath = Path.Combine(
|
||||
Constant.ProgramDirectory,
|
||||
@"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png"
|
||||
|
|
|
|||
|
|
@ -342,8 +342,8 @@ namespace Flow.Launcher.ViewModel
|
|||
Hide();
|
||||
|
||||
await PluginManager.ReloadDataAsync().ConfigureAwait(false);
|
||||
App.API.ShowMsg(App.API.GetTranslation("success"),
|
||||
App.API.GetTranslation("completedSuccessfully"));
|
||||
App.API.ShowMsg(Localize.success(),
|
||||
Localize.completedSuccessfully());
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
|
@ -908,7 +908,7 @@ namespace Flow.Launcher.ViewModel
|
|||
private string _placeholderText;
|
||||
public string PlaceholderText
|
||||
{
|
||||
get => string.IsNullOrEmpty(_placeholderText) ? App.API.GetTranslation("queryTextBoxPlaceholder") : _placeholderText;
|
||||
get => string.IsNullOrEmpty(_placeholderText) ? Localize.queryTextBoxPlaceholder(): _placeholderText;
|
||||
set
|
||||
{
|
||||
_placeholderText = value;
|
||||
|
|
@ -1312,12 +1312,10 @@ namespace Flow.Launcher.ViewModel
|
|||
var results = new List<Result>();
|
||||
foreach (var h in historyItems)
|
||||
{
|
||||
var title = App.API.GetTranslation("executeQuery");
|
||||
var time = App.API.GetTranslation("lastExecuteTime");
|
||||
var result = new Result
|
||||
{
|
||||
Title = string.Format(title, h.Query),
|
||||
SubTitle = string.Format(time, h.ExecutedDateTime),
|
||||
Title = Localize.executeQuery(h.Query),
|
||||
SubTitle = Localize.lastExecuteTime(h.ExecutedDateTime),
|
||||
IcoPath = Constant.HistoryIcon,
|
||||
OriginQuery = new Query { RawQuery = h.Query },
|
||||
Action = _ =>
|
||||
|
|
@ -1714,13 +1712,13 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
menu = new Result
|
||||
{
|
||||
Title = App.API.GetTranslation("cancelTopMostInThisQuery"),
|
||||
Title = Localize.cancelTopMostInThisQuery(),
|
||||
IcoPath = "Images\\down.png",
|
||||
PluginDirectory = Constant.ProgramDirectory,
|
||||
Action = _ =>
|
||||
{
|
||||
_topMostRecord.Remove(result);
|
||||
App.API.ShowMsg(App.API.GetTranslation("success"));
|
||||
App.API.ShowMsg(Localize.success());
|
||||
App.API.ReQuery();
|
||||
return false;
|
||||
},
|
||||
|
|
@ -1732,13 +1730,13 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
menu = new Result
|
||||
{
|
||||
Title = App.API.GetTranslation("setAsTopMostInThisQuery"),
|
||||
Title = Localize.setAsTopMostInThisQuery(),
|
||||
IcoPath = "Images\\up.png",
|
||||
PluginDirectory = Constant.ProgramDirectory,
|
||||
Action = _ =>
|
||||
{
|
||||
_topMostRecord.AddOrUpdate(result);
|
||||
App.API.ShowMsg(App.API.GetTranslation("success"));
|
||||
App.API.ShowMsg(Localize.success());
|
||||
App.API.ReQuery();
|
||||
return false;
|
||||
},
|
||||
|
|
@ -1756,10 +1754,10 @@ namespace Flow.Launcher.ViewModel
|
|||
var metadata = PluginManager.GetPluginForId(id).Metadata;
|
||||
var translator = App.API;
|
||||
|
||||
var author = translator.GetTranslation("author");
|
||||
var website = translator.GetTranslation("website");
|
||||
var version = translator.GetTranslation("version");
|
||||
var plugin = translator.GetTranslation("plugin");
|
||||
var author = Localize.author();
|
||||
var website = Localize.website();
|
||||
var version = Localize.version();
|
||||
var plugin = Localize.plugin();
|
||||
var title = $"{plugin}: {metadata.Name}";
|
||||
var icon = metadata.IcoPath;
|
||||
var subtitle = $"{author} {metadata.Author}";
|
||||
|
|
|
|||
|
|
@ -155,8 +155,7 @@ namespace Flow.Launcher.ViewModel
|
|||
App.API.LogException(ClassName, $"Failed to create setting panel for {pair.Metadata.Name}", e);
|
||||
|
||||
// Show error message in UI
|
||||
var errorMsg = string.Format(App.API.GetTranslation("errorCreatingSettingPanel"),
|
||||
pair.Metadata.Name, Environment.NewLine, e.Message);
|
||||
var errorMsg = Localize.errorCreatingSettingPanel(pair.Metadata.Name, Environment.NewLine, e.Message);
|
||||
return CreateErrorSettingPanel(errorMsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -165,16 +164,16 @@ namespace Flow.Launcher.ViewModel
|
|||
Visibility.Collapsed : Visibility.Visible;
|
||||
public string InitializeTime => PluginPair.Metadata.InitTime + "ms";
|
||||
public string QueryTime => PluginPair.Metadata.AvgQueryTime + "ms";
|
||||
public string Version => App.API.GetTranslation("plugin_query_version") + " " + PluginPair.Metadata.Version;
|
||||
public string Version => Localize.plugin_query_version()+ " " + PluginPair.Metadata.Version;
|
||||
public string InitAndQueryTime =>
|
||||
App.API.GetTranslation("plugin_init_time") + " " +
|
||||
Localize.plugin_init_time()+ " " +
|
||||
PluginPair.Metadata.InitTime + "ms, " +
|
||||
App.API.GetTranslation("plugin_query_time") + " " +
|
||||
Localize.plugin_query_time()+ " " +
|
||||
PluginPair.Metadata.AvgQueryTime + "ms";
|
||||
public string ActionKeywordsText => string.Join(Query.ActionKeywordSeparator, PluginPair.Metadata.ActionKeywords);
|
||||
public string SearchDelayTimeText => PluginPair.Metadata.SearchDelayTime == null ?
|
||||
App.API.GetTranslation("default") :
|
||||
App.API.GetTranslation($"SearchDelayTime{PluginPair.Metadata.SearchDelayTime}");
|
||||
Localize.plugin_default_search_delay_time() :
|
||||
Localize.plugin_search_delay_time(PluginPair.Metadata.SearchDelayTime);
|
||||
public Infrastructure.UserSettings.Plugin PluginSettingsObject{ get; init; }
|
||||
public bool SearchDelayEnabled => Settings.SearchQueryResultsWithDelay;
|
||||
public string DefaultSearchDelay => Settings.SearchDelayTime.ToString();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public partial class SelectBrowserViewModel : BaseModel
|
|||
{
|
||||
CustomBrowsers.Add(new()
|
||||
{
|
||||
Name = App.API.GetTranslation("defaultBrowser_new_profile")
|
||||
Name = Localize.defaultBrowser_new_profile()
|
||||
});
|
||||
SelectedCustomBrowserIndex = CustomBrowsers.Count - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,8 @@ public partial class SelectFileManagerViewModel : BaseModel
|
|||
if (!IsFileManagerValid(CustomExplorer.Path))
|
||||
{
|
||||
var result = App.API.ShowMsgBox(
|
||||
string.Format(App.API.GetTranslation("fileManagerPathNotFound"),
|
||||
CustomExplorer.Name, CustomExplorer.Path),
|
||||
App.API.GetTranslation("fileManagerPathError"),
|
||||
Localize.fileManagerPathNotFound(CustomExplorer.Name, CustomExplorer.Path),
|
||||
Localize.fileManagerPathError(),
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Warning);
|
||||
|
||||
|
|
@ -105,7 +104,7 @@ public partial class SelectFileManagerViewModel : BaseModel
|
|||
{
|
||||
CustomExplorers.Add(new()
|
||||
{
|
||||
Name = App.API.GetTranslation("defaultBrowser_new_profile")
|
||||
Name = Localize.defaultBrowser_new_profile()
|
||||
});
|
||||
SelectedCustomExplorerIndex = CustomExplorers.Count - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,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, )",
|
||||
|
|
|
|||
Loading…
Reference in a new issue