diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index 1df6f2a04..9c5bb9cc3 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Reflection; using System.Windows; +using Flow.Launcher; using Flow.Launcher.Core.Plugin; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; @@ -88,7 +89,6 @@ namespace Flow.Launcher.Core.Resource { language = language.NonNull(); - Settings.Language = language.LanguageCode; RemoveOldLanguageFiles(); if (language != AvailableLanguages.English) @@ -96,6 +96,7 @@ namespace Flow.Launcher.Core.Resource LoadLanguage(language); } UpdatePluginMetadataTranslations(); + Settings.Language = language.LanguageCode; } diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 837fe3b71..832b6fbfa 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -9,10 +9,18 @@ namespace Flow.Launcher.Infrastructure.UserSettings { public class Settings : BaseModel { + private string language = "en"; + public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public bool ShowOpenResultHotkey { get; set; } = true; - public string Language { get; set; } = "en"; + public string Language + { + get => language; set { + language = value; + OnPropertyChanged(); + } + } public string Theme { get; set; } = Constant.DefaultTheme; public bool UseDropShadowEffect { get; set; } = false; public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name; diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 28ad80603..558388762 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -52,11 +52,12 @@ namespace Flow.Launcher private void OnInitialized(object sender, EventArgs e) { - // show notify icon when flowlauncher is hided + } private void OnLoaded(object sender, RoutedEventArgs _) { + // show notify icon when flowlauncher is hidden InitializeNotifyIcon(); // todo is there a way to set blur only once? @@ -88,11 +89,19 @@ namespace Flow.Launcher }; _settings.PropertyChanged += (o, e) => { - if (e.PropertyName == nameof(Settings.HideNotifyIcon)) + switch (e.PropertyName) { - _notifyIcon.Visible = !_settings.HideNotifyIcon; + case nameof(Settings.HideNotifyIcon): + _notifyIcon.Visible = !_settings.HideNotifyIcon; + break; + case nameof(Settings.Language): + UpdateNotifyIconText(); + break; } }; + + + InitializePosition(); } @@ -104,6 +113,18 @@ namespace Flow.Launcher _settings.WindowLeft = Left; } + private void UpdateNotifyIconText() + { + var menu = _notifyIcon.ContextMenuStrip; + var open = menu.Items[0]; + var setting = menu.Items[1]; + var exit = menu.Items[2]; + + open.Text = InternationalizationManager.Instance.GetTranslation("iconTrayOpen"); + setting.Text = InternationalizationManager.Instance.GetTranslation("iconTraySettings"); + exit.Text = InternationalizationManager.Instance.GetTranslation("iconTrayExit"); + } + private void InitializeNotifyIcon() { _notifyIcon = new NotifyIcon