mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #781 from Flow-Launcher/translation_new_api
Add OnCultureInfoChanged to IPluginI18n
This commit is contained in:
commit
d0ceea089d
6 changed files with 26 additions and 10 deletions
|
|
@ -10,6 +10,7 @@ using Flow.Launcher.Infrastructure.Logger;
|
|||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Flow.Launcher.Core.Resource
|
||||
{
|
||||
|
|
@ -95,10 +96,13 @@ namespace Flow.Launcher.Core.Resource
|
|||
{
|
||||
LoadLanguage(language);
|
||||
}
|
||||
UpdatePluginMetadataTranslations();
|
||||
Settings.Language = language.LanguageCode;
|
||||
CultureInfo.CurrentCulture = new CultureInfo(language.LanguageCode);
|
||||
CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture;
|
||||
Task.Run(() =>
|
||||
{
|
||||
UpdatePluginMetadataTranslations();
|
||||
});
|
||||
}
|
||||
|
||||
public bool PromptShouldUsePinyin(string languageCodeToSet)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
namespace Flow.Launcher.Plugin
|
||||
using System.Globalization;
|
||||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Represent plugins that support internationalization
|
||||
|
|
@ -8,5 +10,13 @@
|
|||
string GetTranslatedPluginTitle();
|
||||
|
||||
string GetTranslatedPluginDescription();
|
||||
|
||||
/// <summary>
|
||||
/// The method will be invoked when language of flow changed
|
||||
/// </summary>
|
||||
void OnCultureInfoChanged(CultureInfo newCulture)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ namespace Flow.Plugin.WindowsSettings.Classes
|
|||
/// <summary>
|
||||
/// A windows setting
|
||||
/// </summary>
|
||||
internal class WindowsSetting
|
||||
internal record WindowsSetting
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WindowsSetting"/> class.
|
||||
|
|
|
|||
|
|
@ -150,12 +150,8 @@ namespace Flow.Plugin.WindowsSettings.Helper
|
|||
ProcessStartInfo processStartInfo;
|
||||
|
||||
var command = entry.Command;
|
||||
|
||||
if (command.Contains("%windir%", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var windowsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
|
||||
command = command.Replace("%windir%", windowsFolder, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
command = Environment.ExpandEnvironmentVariables(command);
|
||||
|
||||
if (command.Contains(' '))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ namespace Flow.Plugin.WindowsSettings.Helper
|
|||
}
|
||||
|
||||
}
|
||||
var translatedSetting = new WindowsSetting
|
||||
var translatedSetting = settings with
|
||||
{
|
||||
Area = area ?? settings.Area,
|
||||
Name = name ?? settings.Name,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Plugin.WindowsSettings.Classes;
|
||||
|
|
@ -106,6 +107,11 @@ namespace Flow.Plugin.WindowsSettings
|
|||
|
||||
}
|
||||
|
||||
public void OnCultureInfoChanged(CultureInfo newCulture)
|
||||
{
|
||||
_translatedSettingList = TranslationHelper.TranslateAllSettings(_settingsList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a list context menu entries for a given <see cref="Result"/> (shown at the right side of the result).
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue