Fix CultureInfo Reflect Preview/Flow

This commit is contained in:
DB p 2022-11-20 15:14:43 +09:00
parent 51dc61376e
commit 6c22bdaa16
2 changed files with 11 additions and 4 deletions

View file

@ -23,6 +23,7 @@ using ISavable = Flow.Launcher.Plugin.ISavable;
using System.IO;
using System.Collections.Specialized;
using CommunityToolkit.Mvvm.Input;
using System.Globalization;
namespace Flow.Launcher.ViewModel
{
@ -326,6 +327,7 @@ namespace Flow.Launcher.ViewModel
public string ClockText { get; private set; }
public string DateText { get; private set; }
public CultureInfo cultureInfo => new CultureInfo(Settings.Language);
private async Task RegisterClockAndDateUpdateAsync()
{
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
@ -333,9 +335,9 @@ namespace Flow.Launcher.ViewModel
while (await timer.WaitForNextTickAsync().ConfigureAwait(false))
{
if (Settings.UseClock)
ClockText = DateTime.Now.ToString(Settings.TimeFormat);
ClockText = DateTime.Now.ToString(Settings.TimeFormat, cultureInfo);
if (Settings.UseDate)
DateText = DateTime.Now.ToString(Settings.DateFormat);
DateText = DateTime.Now.ToString(Settings.DateFormat, cultureInfo);
}
}
public ResultsViewModel Results { get; private set; }

View file

@ -55,6 +55,10 @@ namespace Flow.Launcher.ViewModel
case nameof(Settings.TimeFormat):
OnPropertyChanged(nameof(ClockText));
break;
case nameof(Settings.Language):
OnPropertyChanged(nameof(ClockText));
OnPropertyChanged(nameof(DateText));
break;
}
};
}
@ -80,6 +84,7 @@ namespace Flow.Launcher.ViewModel
}
}
public CultureInfo cultureInfo => new CultureInfo(Settings.Language);
public bool StartFlowLauncherOnSystemStartup
{
get => Settings.StartFlowLauncherOnSystemStartup;
@ -500,9 +505,9 @@ namespace Flow.Launcher.ViewModel
set { Settings.DateFormat = value; }
}
public string ClockText => DateTime.Now.ToString(TimeFormat);
public string ClockText => DateTime.Now.ToString(TimeFormat, cultureInfo);
public string DateText => DateTime.Now.ToString(DateFormat);
public string DateText => DateTime.Now.ToString(DateFormat, cultureInfo);
public double WindowWidthSize