From ad538ba767d0fe38193d55fa6a92cafb4bc841ff Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner <lorenz.stechauner@necronda.net> Date: Thu, 13 Jul 2023 16:57:39 +0200 Subject: [PATCH] Set global locale to de-DE --- Elwig/App.xaml.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Elwig/App.xaml.cs b/Elwig/App.xaml.cs index 9bc1871..b996194 100644 --- a/Elwig/App.xaml.cs +++ b/Elwig/App.xaml.cs @@ -8,6 +8,9 @@ using Elwig.Helpers; using Elwig.Helpers.Weighing; using System.Collections.Generic; using System.Windows.Threading; +using System.Globalization; +using System.Threading; +using System.Windows.Markup; namespace Elwig { public partial class App : Application { @@ -32,6 +35,16 @@ namespace Elwig { } protected override void OnStartup(StartupEventArgs evt) { + var locale = new CultureInfo("de-DE"); // de-AT uses ' ' as thousands separator :( + Thread.CurrentThread.CurrentCulture = locale; + Thread.CurrentThread.CurrentUICulture = locale; + CultureInfo.DefaultThreadCurrentCulture = locale; + CultureInfo.DefaultThreadCurrentUICulture = locale; + FrameworkElement.LanguageProperty.OverrideMetadata( + typeof(FrameworkElement), + new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)) + ); + Dictionary<string, string> branches = new(); using (var ctx = new AppDbContext()) { if (!ctx.Database.CanConnect()) {