diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs
index 8e05686c9..a94b265fc 100644
--- a/Flow.Launcher/ActionKeywords.xaml.cs
+++ b/Flow.Launcher/ActionKeywords.xaml.cs
@@ -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
{
diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs
index 8ec11e5ff..58f8438d2 100644
--- a/Flow.Launcher/App.xaml.cs
+++ b/Flow.Launcher/App.xaml.cs
@@ -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);
}
}
}
diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
index 2ee08bf85..3bba2c5b8 100644
--- a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
+++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
@@ -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;
}
diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs
index f4644a267..317d059a1 100644
--- a/Flow.Launcher/CustomShortcutSetting.xaml.cs
+++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs
@@ -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;
}
diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj
index c486023d0..aa8e95429 100644
--- a/Flow.Launcher/Flow.Launcher.csproj
+++ b/Flow.Launcher/Flow.Launcher.csproj
@@ -37,6 +37,7 @@
prompt
4
false
+ $(NoWarn);FLSG0007
@@ -132,6 +133,7 @@
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -161,6 +163,10 @@
+
+ true
+
+
Always
diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs
index 86a68475e..bb1cddc6c 100644
--- a/Flow.Launcher/Helper/HotKeyMapper.cs
+++ b/Flow.Launcher/Helper/HotKeyMapper.cs
@@ -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);
}
}
diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs
index 89bfde349..b920b53a7 100644
--- a/Flow.Launcher/HotkeyControl.xaml.cs
+++ b/Flow.Launcher/HotkeyControl.xaml.cs
@@ -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 KeysToDisplay { get; set; } = new();
diff --git a/Flow.Launcher/HotkeyControlDialog.xaml.cs b/Flow.Launcher/HotkeyControlDialog.xaml.cs
index c7af8c5b8..740425f8b 100644
--- a/Flow.Launcher/HotkeyControlDialog.xaml.cs
+++ b/Flow.Launcher/HotkeyControlDialog.xaml.cs
@@ -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;
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index 561bb277e..a51782f40 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -209,6 +209,8 @@
Version
Website
Uninstall
+ Search delay time: default
+ Search delay time: {0}ms
Fail to remove plugin settings
Plugins: {0} - Fail to remove plugin settings files, please remove them manually
Fail to remove plugin cache
@@ -588,7 +590,7 @@
The specified file manager could not be found. Please check the Custom File Manager setting under Settings > General.
Error
- An error occurred while opening the folder. {0}
+ An error occurred while opening the folder.
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
File or directory not found: {0}
diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs
index 7b6a0d79b..21cb124b0 100644
--- a/Flow.Launcher/MainWindow.xaml.cs
+++ b/Flow.Launcher/MainWindow.xaml.cs
@@ -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);
diff --git a/Flow.Launcher/PluginUpdateWindow.xaml.cs b/Flow.Launcher/PluginUpdateWindow.xaml.cs
index 20f033425..4b56e5836 100644
--- a/Flow.Launcher/PluginUpdateWindow.xaml.cs
+++ b/Flow.Launcher/PluginUpdateWindow.xaml.cs
@@ -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;
}
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index b4c3aa92b..bd2f80743 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -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);
}
}
}
diff --git a/Flow.Launcher/ReleaseNotesWindow.xaml.cs b/Flow.Launcher/ReleaseNotesWindow.xaml.cs
index ce7a3e084..4e3f30d30 100644
--- a/Flow.Launcher/ReleaseNotesWindow.xaml.cs
+++ b/Flow.Launcher/ReleaseNotesWindow.xaml.cs
@@ -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
{
diff --git a/Flow.Launcher/ReportWindow.xaml.cs b/Flow.Launcher/ReportWindow.xaml.cs
index ae0767934..bb0ce0073 100644
--- a/Flow.Launcher/ReportWindow.xaml.cs
+++ b/Flow.Launcher/ReportWindow.xaml.cs
@@ -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();
diff --git a/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs
index 10cd18821..5e3ab6815 100644
--- a/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs
+++ b/Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs
@@ -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);
}
}
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs
index 647b36701..f906bf55c 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs
@@ -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 { }
@@ -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());
}
}
}
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
index 885330b8c..6641ac689 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
@@ -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 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"
);
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs
index 9e6a31dc7..3e7c3cb83 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs
@@ -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;
}
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs
index f133b7d2b..d67695a75 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs
@@ -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);
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
index 98dac499f..70bcbcc18 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
@@ -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"
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index d492f28c5..66fa70682 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -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();
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}";
diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs
index 29f2b9b43..87d1839c7 100644
--- a/Flow.Launcher/ViewModel/PluginViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginViewModel.cs
@@ -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();
diff --git a/Flow.Launcher/ViewModel/SelectBrowserViewModel.cs b/Flow.Launcher/ViewModel/SelectBrowserViewModel.cs
index e3a0e4e44..04602dcae 100644
--- a/Flow.Launcher/ViewModel/SelectBrowserViewModel.cs
+++ b/Flow.Launcher/ViewModel/SelectBrowserViewModel.cs
@@ -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;
}
diff --git a/Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs b/Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs
index f6a32e3fe..42c818042 100644
--- a/Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs
+++ b/Flow.Launcher/ViewModel/SelectFileManagerViewModel.cs
@@ -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;
}
diff --git a/Flow.Launcher/packages.lock.json b/Flow.Launcher/packages.lock.json
index c90db6b0c..c3c8f60e3 100644
--- a/Flow.Launcher/packages.lock.json
+++ b/Flow.Launcher/packages.lock.json
@@ -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, )",