Skip to content

Commit 6c22bda

Browse files
committed
Fix CultureInfo Reflect Preview/Flow
1 parent 51dc613 commit 6c22bda

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using System.IO;
2424
using System.Collections.Specialized;
2525
using CommunityToolkit.Mvvm.Input;
26+
using System.Globalization;
2627

2728
namespace Flow.Launcher.ViewModel
2829
{
@@ -326,16 +327,17 @@ private void InitializeKeyCommands()
326327
public string ClockText { get; private set; }
327328
public string DateText { get; private set; }
328329

330+
public CultureInfo cultureInfo => new CultureInfo(Settings.Language);
329331
private async Task RegisterClockAndDateUpdateAsync()
330332
{
331333
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
332334
// ReSharper disable once MethodSupportsCancellation
333335
while (await timer.WaitForNextTickAsync().ConfigureAwait(false))
334336
{
335337
if (Settings.UseClock)
336-
ClockText = DateTime.Now.ToString(Settings.TimeFormat);
338+
ClockText = DateTime.Now.ToString(Settings.TimeFormat, cultureInfo);
337339
if (Settings.UseDate)
338-
DateText = DateTime.Now.ToString(Settings.DateFormat);
340+
DateText = DateTime.Now.ToString(Settings.DateFormat, cultureInfo);
339341
}
340342
}
341343
public ResultsViewModel Results { get; private set; }

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public SettingWindowViewModel(Updater updater, IPortable portable)
5555
case nameof(Settings.TimeFormat):
5656
OnPropertyChanged(nameof(ClockText));
5757
break;
58+
case nameof(Settings.Language):
59+
OnPropertyChanged(nameof(ClockText));
60+
OnPropertyChanged(nameof(DateText));
61+
break;
5862
}
5963
};
6064
}
@@ -80,6 +84,7 @@ public bool AutoUpdates
8084
}
8185
}
8286

87+
public CultureInfo cultureInfo => new CultureInfo(Settings.Language);
8388
public bool StartFlowLauncherOnSystemStartup
8489
{
8590
get => Settings.StartFlowLauncherOnSystemStartup;
@@ -500,9 +505,9 @@ public string DateFormat
500505
set { Settings.DateFormat = value; }
501506
}
502507

503-
public string ClockText => DateTime.Now.ToString(TimeFormat);
508+
public string ClockText => DateTime.Now.ToString(TimeFormat, cultureInfo);
504509

505-
public string DateText => DateTime.Now.ToString(DateFormat);
510+
public string DateText => DateTime.Now.ToString(DateFormat, cultureInfo);
506511

507512

508513
public double WindowWidthSize

0 commit comments

Comments
 (0)