Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Flow.Launcher.Core/Resource/Internationalization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using System.Globalization;
using System.Threading.Tasks;

namespace Flow.Launcher.Core.Resource
{
Expand Down Expand Up @@ -95,10 +96,13 @@ public void ChangeLanguage(Language language)
{
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)
Expand Down
12 changes: 11 additions & 1 deletion Flow.Launcher.Plugin/Interfaces/IPluginI18n.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Flow.Launcher.Plugin
using System.Globalization;

namespace Flow.Launcher.Plugin
{
/// <summary>
/// Represent plugins that support internationalization
Expand All @@ -8,5 +10,13 @@ public interface IPluginI18n : IFeatures
string GetTranslatedPluginTitle();

string GetTranslatedPluginDescription();

/// <summary>
/// The method will be invoked when language of flow changed
/// </summary>
void OnCultureInfoChanged(CultureInfo newCulture)
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,8 @@ private static bool DoOpenSettingsAction(WindowsSetting entry)
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(' '))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal static IEnumerable<WindowsSetting> TranslateAllSettings(in IEnumerable<
}

}
var translatedSetting = new WindowsSetting
var translatedSetting = settings with
{
Area = area ?? settings.Area,
Name = name ?? settings.Name,
Expand Down
6 changes: 6 additions & 0 deletions Plugins/Flow.Launcher.Plugin.WindowsSettings/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -106,6 +107,11 @@ public List<Result> Query(Query query)

}

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>
Expand Down