From e1356f76cc768496e4ab037ddf387a237d8582db Mon Sep 17 00:00:00 2001 From: Alex Ma Date: Tue, 28 Sep 2021 17:40:15 -0700 Subject: [PATCH] added preserve user number format and date/time format along with dotnet bump. (#1252) * added preserve user number format and date/time format * removed flag * revert version --- .../Utility/CommandOptions.cs | 9 ++++++++- src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/external/Microsoft.SqlTools.Hosting.v2/Utility/CommandOptions.cs b/external/Microsoft.SqlTools.Hosting.v2/Utility/CommandOptions.cs index cdfdb568..106490bf 100644 --- a/external/Microsoft.SqlTools.Hosting.v2/Utility/CommandOptions.cs +++ b/external/Microsoft.SqlTools.Hosting.v2/Utility/CommandOptions.cs @@ -43,7 +43,7 @@ namespace Microsoft.SqlTools.Hosting.Utility { case "-autoflush-log": AutoFlushLog = true; - break; + break; case "-tracing-level": TracingLevel = args[++i]; break; @@ -150,6 +150,13 @@ namespace Microsoft.SqlTools.Hosting.Utility CultureInfo language = new CultureInfo(locale); Locale = locale; + // Allow the system set Number Format and Date Format to be preserved when changing the locale. + NumberFormatInfo NumberFormat = CultureInfo.CurrentCulture.NumberFormat; + DateTimeFormatInfo DateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat; + + language.NumberFormat = NumberFormat; + language.DateTimeFormat = DateTimeFormat; + // Setting our language globally CultureInfo.CurrentCulture = language; CultureInfo.CurrentUICulture = language; diff --git a/src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs b/src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs index ee99604b..e7379edb 100644 --- a/src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs +++ b/src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs @@ -44,7 +44,7 @@ namespace Microsoft.SqlTools.Hosting.Utility { case "-autoflush-log": AutoFlushLog = true; - break; + break; case "-tracing-level": TracingLevel = args[++i]; break; @@ -155,6 +155,13 @@ namespace Microsoft.SqlTools.Hosting.Utility // Creating cultureInfo from our given locale CultureInfo language = new CultureInfo(locale); Locale = locale; + + // Allow the system set Number Format and Date Format to be preserved when changing the locale. + NumberFormatInfo NumberFormat = CultureInfo.CurrentCulture.NumberFormat; + DateTimeFormatInfo DateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat; + + language.NumberFormat = NumberFormat; + language.DateTimeFormat = DateTimeFormat; // Setting our language globally CultureInfo.CurrentCulture = language;