From f4c24d9578a0e45d4fa271632bc46e2c8e1dba04 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Wed, 9 Aug 2023 18:48:50 +0200 Subject: [PATCH] Use de-AT locale with narrow nbsp --- Elwig/App.xaml.cs | 5 ++++- Elwig/Dialogs/ManualWeighingDialog.xaml.cs | 2 +- Elwig/Windows/DeliveryAdminWindow.xaml.cs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Elwig/App.xaml.cs b/Elwig/App.xaml.cs index 7af4bd0..62f78a4 100644 --- a/Elwig/App.xaml.cs +++ b/Elwig/App.xaml.cs @@ -35,7 +35,10 @@ namespace Elwig { } protected override void OnStartup(StartupEventArgs evt) { - var locale = new CultureInfo("de-DE"); // de-AT uses ' ' as thousands separator :( + var locale = new CultureInfo("de-AT"); + locale.NumberFormat.CurrencyGroupSeparator = "\u202f"; + locale.NumberFormat.NumberGroupSeparator = "\u202f"; + locale.NumberFormat.PercentGroupSeparator = "\u202f"; Thread.CurrentThread.CurrentCulture = locale; Thread.CurrentThread.CurrentUICulture = locale; CultureInfo.DefaultThreadCurrentCulture = locale; diff --git a/Elwig/Dialogs/ManualWeighingDialog.xaml.cs b/Elwig/Dialogs/ManualWeighingDialog.xaml.cs index 5c4d036..9c33f6d 100644 --- a/Elwig/Dialogs/ManualWeighingDialog.xaml.cs +++ b/Elwig/Dialogs/ManualWeighingDialog.xaml.cs @@ -15,7 +15,7 @@ namespace Elwig.Dialogs { private void ConfirmButton_Click(object sender, RoutedEventArgs evt) { DialogResult = true; - Weight = int.Parse(WeightInput.Text.Replace(".", "")); + Weight = int.Parse(WeightInput.Text.Replace("\u202f", "")); Reason = Regex.Replace(ReasonInput.Text, @"\s+", "").Trim(); if (Reason == "") { Reason = null; diff --git a/Elwig/Windows/DeliveryAdminWindow.xaml.cs b/Elwig/Windows/DeliveryAdminWindow.xaml.cs index 1cba19a..f69095e 100644 --- a/Elwig/Windows/DeliveryAdminWindow.xaml.cs +++ b/Elwig/Windows/DeliveryAdminWindow.xaml.cs @@ -297,7 +297,7 @@ namespace Elwig.Windows { d.Comment = (CommentInput.Text == "") ? null : CommentInput.Text; p.SortId = (WineVarietyInput.SelectedItem as WineVar)?.SortId; - p.Weight = int.Parse(WeightInput.Text.Replace(".", "")); + p.Weight = int.Parse(WeightInput.Text.Replace("\u202f", "")); p.Kmw = double.Parse(GradationKmwInput.Text); p.QualId = (WineQualityLevelInput.SelectedItem as WineQualLevel)?.QualId; p.HkId = (WineOriginInput.SelectedItem as WineOrigin)?.HkId;