diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index 4568e92f3..acc693ed5 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -96,9 +96,16 @@ namespace Flow.Launcher.Core.Resource { LoadLanguage(language); } - Settings.Language = language.LanguageCode; - CultureInfo.CurrentCulture = new CultureInfo(language.LanguageCode); + // Culture of this thread + // Use CreateSpecificCulture to preserve possible user-override settings in Windows + CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture(language.LanguageCode); CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture; + // App domain + CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture(language.LanguageCode); + CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.DefaultThreadCurrentCulture; + + // Raise event after culture is set + Settings.Language = language.LanguageCode; _ = Task.Run(() => { UpdatePluginMetadataTranslations(); @@ -186,7 +193,7 @@ namespace Flow.Launcher.Core.Resource { p.Metadata.Name = pluginI18N.GetTranslatedPluginTitle(); p.Metadata.Description = pluginI18N.GetTranslatedPluginDescription(); - pluginI18N.OnCultureInfoChanged(CultureInfo.CurrentCulture); + pluginI18N.OnCultureInfoChanged(CultureInfo.DefaultThreadCurrentCulture); } catch (Exception e) { diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 33072b53d..3561c6ffe 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -6,7 +6,6 @@ using System.Text.Json.Serialization; using System.Windows; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; -using Flow.Launcher; using Flow.Launcher.ViewModel; namespace Flow.Launcher.Infrastructure.UserSettings diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs index ecdfc5851..1e39473e0 100644 --- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs +++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs @@ -52,7 +52,8 @@ namespace Flow.Launcher.Converters // Check if Text will be larger then our QueryTextBox System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch); - System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black); + // TODO: Obsolete warning? + System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.DefaultThreadCurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black); var offset = QueryTextBox.Padding.Right; @@ -75,4 +76,4 @@ namespace Flow.Launcher.Converters throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index c1fe421fb..b1a822fb6 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -126,4 +126,4 @@ - \ No newline at end of file + diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 2e22929eb..49854ed81 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -1,4 +1,5 @@ - - + - - - - - + + + + - - - - - - - - - - - - + + - - - + + - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Visibility="{Binding Settings.UseClock, Converter={StaticResource BoolToVisibilityConverter}}" /> + Visibility="{Binding Settings.UseDate, Converter={StaticResource BoolToVisibilityConverter}}" /> - - - - - + + + + + + + + - - - - - + + + - @@ -327,16 +343,14 @@ - - - + + + - @@ -345,16 +359,14 @@ - - - + + + - diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 691158630..d44830f52 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -7,7 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:Flow.Launcher.ViewModel" MaxHeight="{Binding MaxHeight}" - Margin="{Binding Margin}" + Margin="{DynamicResource ResultMargin}" HorizontalContentAlignment="Stretch" d:DataContext="{d:DesignInstance vm:ResultsViewModel}" d:DesignHeight="100" @@ -17,6 +17,10 @@ ItemsSource="{Binding Results}" KeyboardNavigation.DirectionalNavigation="Cycle" PreviewMouseDown="ListBox_PreviewMouseDown" + PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown" + PreviewMouseLeftButtonUp="ResultListBox_OnPreviewMouseUp" + PreviewMouseMove="ResultList_MouseMove" + PreviewMouseRightButtonDown="ResultListBox_OnPreviewMouseRightButtonDown" SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" SelectionChanged="OnSelectionChanged" @@ -25,17 +29,12 @@ VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard" Visibility="{Binding Visbility}" - mc:Ignorable="d" - PreviewMouseMove="ResultList_MouseMove" - PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown" - PreviewMouseLeftButtonUp="ResultListBox_OnPreviewMouseUp" - PreviewMouseRightButtonDown="ResultListBox_OnPreviewMouseRightButtonDown"> + mc:Ignorable="d"> -