mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Localize startup messages about missing Python/NodeJS
This commit is contained in:
parent
9b9ebfc861
commit
ca970bbe75
6 changed files with 35 additions and 16 deletions
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
|
||||
namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
||||
{
|
||||
|
|
@ -50,14 +51,15 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|||
return SetPathForPluginPairs(PluginsSettingsFilePath, Language);
|
||||
}
|
||||
|
||||
if (MessageBox.Show($"Flow detected you have installed {Language} plugins, which " +
|
||||
$"will require {EnvName} to run. Would you like to download {EnvName}? " +
|
||||
Environment.NewLine + Environment.NewLine +
|
||||
"Click no if it's already installed, " +
|
||||
$"and you will be prompted to select the folder that contains the {EnvName} executable",
|
||||
string.Empty, MessageBoxButtons.YesNo) == DialogResult.No)
|
||||
var noRuntimeMessage = string.Format(
|
||||
InternationalizationManager.Instance.GetTranslation("runtimePluginInstalledChooseRuntimePrompt"),
|
||||
Language,
|
||||
EnvName,
|
||||
Environment.NewLine
|
||||
);
|
||||
if (MessageBox.Show(noRuntimeMessage, string.Empty, MessageBoxButtons.YesNo) == DialogResult.No)
|
||||
{
|
||||
var msg = $"Please select the {EnvName} executable";
|
||||
var msg = string.Format(InternationalizationManager.Instance.GetTranslation("runtimePluginChooseRuntimeExecutable"), EnvName);
|
||||
string selectedFile;
|
||||
|
||||
selectedFile = GetFileFromDialog(msg, FileDialogFilter);
|
||||
|
|
@ -80,8 +82,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
|
|||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(
|
||||
$"Unable to set {Language} executable path, please try from Flow's settings (scroll down to the bottom).");
|
||||
MessageBox.Show(string.Format(InternationalizationManager.Instance.GetTranslation("runtimePluginUnableToSetExecutablePath"), Language));
|
||||
Log.Error("PluginsLoader",
|
||||
$"Not able to successfully set {EnvName} path, setting's plugin executable path variable is still an empty string.",
|
||||
$"{Language}Environment");
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using Flow.Launcher.Plugin;
|
|||
using ISavable = Flow.Launcher.Plugin.ISavable;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using System.Text.Json;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
|
||||
namespace Flow.Launcher.Core.Plugin
|
||||
{
|
||||
|
|
@ -160,6 +161,9 @@ namespace Flow.Launcher.Core.Plugin
|
|||
}
|
||||
}
|
||||
|
||||
InternationalizationManager.Instance.AddPluginLanguageDirectories();
|
||||
InternationalizationManager.Instance.ChangeLanguage(InternationalizationManager.Instance.Settings.Language);
|
||||
|
||||
if (failedPlugins.Any())
|
||||
{
|
||||
var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name));
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ namespace Flow.Launcher.Core.Resource
|
|||
|
||||
public Internationalization()
|
||||
{
|
||||
AddPluginLanguageDirectories();
|
||||
LoadDefaultLanguage();
|
||||
// we don't want to load /Languages/en.xaml twice
|
||||
// so add flowlauncher language directory after load plugin language files
|
||||
|
|
@ -40,7 +39,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
}
|
||||
|
||||
|
||||
private void AddPluginLanguageDirectories()
|
||||
internal void AddPluginLanguageDirectories()
|
||||
{
|
||||
foreach (var plugin in PluginManager.GetPluginsForInterface<IPluginI18n>())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ namespace Flow.Launcher
|
|||
StringMatcher.Instance = _stringMatcher;
|
||||
_stringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision;
|
||||
|
||||
InternationalizationManager.Instance.Settings = _settings;
|
||||
InternationalizationManager.Instance.ChangeLanguage(_settings.Language);
|
||||
|
||||
PluginManager.LoadPlugins(_settings.PluginSettings);
|
||||
_mainVM = new MainViewModel(_settings);
|
||||
|
||||
|
|
@ -89,11 +92,6 @@ namespace Flow.Launcher
|
|||
Current.MainWindow = window;
|
||||
Current.MainWindow.Title = Constant.FlowLauncher;
|
||||
|
||||
// todo temp fix for instance code logic
|
||||
// load plugin before change language, because plugin language also needs be changed
|
||||
InternationalizationManager.Instance.Settings = _settings;
|
||||
InternationalizationManager.Instance.ChangeLanguage(_settings.Language);
|
||||
|
||||
HotKeyMapper.Initialize(_mainVM);
|
||||
|
||||
// main windows needs initialized before theme change because of blur settings
|
||||
|
|
|
|||
|
|
@ -2,6 +2,15 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- Startup -->
|
||||
<system:String x:Key="runtimePluginInstalledChooseRuntimePrompt">
|
||||
Flow detected you have installed {0} plugins, which will require {1} to run. Would you like to download {1}?
|
||||
{2}{2}
|
||||
Click no if it's already installed, and you will be prompted to select the folder that contains the {1} executable
|
||||
</system:String>
|
||||
<system:String x:Key="runtimePluginChooseRuntimeExecutable">Please select the {0} executable</system:String>
|
||||
<system:String x:Key="runtimePluginUnableToSetExecutablePath">Unable to set {0} executable path, please try from Flow's settings (scroll down to the bottom).</system:String>
|
||||
|
||||
<!-- MainWindow -->
|
||||
<system:String x:Key="registerHotkeyFailed">Failed to register hotkey "{0}". The hotkey may be in use by another program. Change to a different hotkey, or exit another program.</system:String>
|
||||
<system:String x:Key="MessageBoxTitle">Flow Launcher</system:String>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,14 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- Startup -->
|
||||
<system:String x:Key="runtimePluginInstalledChooseRuntimePrompt">
|
||||
Flow определил, что вы установили {0} плагины, которым требуется {1} для работы. Скачать {1}?
|
||||
{2}{2}
|
||||
Кликните нет, если он уже установлен, и вам будет предложено выбрать папку, где находится исполняемый файл {1}
|
||||
</system:String>
|
||||
<system:String x:Key="runtimePluginChooseRuntimeExecutable">Please select the {0} executable</system:String>
|
||||
<system:String x:Key="runtimePluginUnableToSetExecutablePath">Unable to set {0} executable path, please try from Flow's settings (scroll down to the bottom).</system:String>
|
||||
<!-- MainWindow -->
|
||||
<system:String x:Key="registerHotkeyFailed">Не удалось зарегистрировать сочетание клавиш "{0}". Возможно, оно используется другой программой. Измените сочетание клавиш или закройте другую программу.</system:String>
|
||||
<system:String x:Key="MessageBoxTitle">Flow Launcher</system:String>
|
||||
|
|
|
|||
Loading…
Reference in a new issue