Skip to content

Commit 0315053

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

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public SettingWindowViewModel(Updater updater, IPortable portable)
5555
case nameof(Settings.TimeFormat):
5656
OnPropertyChanged(nameof(ClockText));
5757
break;
58+
5859
}
5960
};
6061
}
@@ -80,6 +81,7 @@ public bool AutoUpdates
8081
}
8182
}
8283

84+
public CultureInfo cultureInfo => new CultureInfo(Settings.Language);
8385
public bool StartFlowLauncherOnSystemStartup
8486
{
8587
get => Settings.StartFlowLauncherOnSystemStartup;
@@ -500,9 +502,9 @@ public string DateFormat
500502
set { Settings.DateFormat = value; }
501503
}
502504

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

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

507509

508510
public double WindowWidthSize

0 commit comments

Comments
 (0)