-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Culture Specified by User in case it differs with that of OS #1712
Changes from 1 commit
886953f
2174b94
3ca4e23
797c6dc
e01b1b1
4cc12d6
6f27ccb
a75cbe5
391c1a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ namespace Microsoft.VisualStudio.TestPlatform.DataCollector | |
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; | ||
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; | ||
using Microsoft.VisualStudio.TestPlatform.Utilities; | ||
using PlatformAbstractions.Interfaces; | ||
using CommunicationUtilitiesResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources; | ||
using CoreUtilitiesConstants = Microsoft.VisualStudio.TestPlatform.CoreUtilities.Constants; | ||
|
@@ -140,6 +141,23 @@ private void WaitForDebuggerIfEnabled() | |
} | ||
} | ||
|
||
private static void SetCultureSpecifiedByUser() | ||
{ | ||
var userCultureSpecified = Environment.GetEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE"); | ||
if (!string.IsNullOrWhiteSpace(userCultureSpecified)) | ||
{ | ||
try | ||
{ | ||
CultureInfo info = new CultureInfo(userCultureSpecified); | ||
CultureInfo.DefaultThreadCurrentUICulture = info; | ||
} | ||
catch (Exception) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do EqtTrace here. |
||
ConsoleOutput.Instance.WriteLine(string.Format("Invalid Culture Info: {0}", userCultureSpecified), OutputLevel.Information); | ||
} | ||
} | ||
} | ||
|
||
private void StartProcessing() | ||
{ | ||
var timeout = EnvironmentHelper.GetConnectionTimeout(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.TestHost | |
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
|
||
using System.Globalization; | ||
using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers; | ||
using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
|
@@ -52,6 +52,7 @@ public static void Main(string[] args) | |
public static void Run(string[] args) | ||
{ | ||
WaitForDebuggerIfEnabled(); | ||
SetCultureSpecifiedByUser(); | ||
var argsDictionary = CommandLineArgumentsHelper.GetArgumentsDictionary(args); | ||
|
||
// Invoke the engine with arguments | ||
|
@@ -103,5 +104,22 @@ private static void WaitForDebuggerIfEnabled() | |
Debugger.Break(); | ||
} | ||
} | ||
|
||
private static void SetCultureSpecifiedByUser() | ||
{ | ||
var userCultureSpecified = Environment.GetEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DRY. |
||
if (!string.IsNullOrWhiteSpace(userCultureSpecified)) | ||
{ | ||
try | ||
{ | ||
CultureInfo info = new CultureInfo(userCultureSpecified); | ||
CultureInfo.DefaultThreadCurrentUICulture = info; | ||
} | ||
catch (Exception) | ||
{ | ||
ConsoleOutput.Instance.WriteLine(string.Format("Invalid Culture Info: {0}", userCultureSpecified), OutputLevel.Information); | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
namespace Microsoft.VisualStudio.TestPlatform.CommandLine | ||
{ | ||
using System; | ||
using System.Globalization; | ||
using Microsoft.VisualStudio.TestPlatform.Utilities; | ||
|
||
/// <summary> | ||
|
@@ -36,7 +37,26 @@ public static int Main(string[] args) | |
System.Diagnostics.Debugger.Break(); | ||
} | ||
|
||
SetCultureSpecifiedByUser(); | ||
|
||
return new Executor(ConsoleOutput.Instance).Execute(args); | ||
} | ||
|
||
private static void SetCultureSpecifiedByUser() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DRY. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specify where it should be common for all these 3 different application |
||
{ | ||
var userCultureSpecified = Environment.GetEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE"); | ||
if(!string.IsNullOrWhiteSpace(userCultureSpecified)) | ||
{ | ||
try | ||
{ | ||
CultureInfo info = new CultureInfo(userCultureSpecified); | ||
CultureInfo.DefaultThreadCurrentUICulture = info; | ||
} | ||
catch(Exception) | ||
{ | ||
ConsoleOutput.Instance.WriteLine(string.Format("Invalid Culture Info: {0}", userCultureSpecified), OutputLevel.Information); | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add example testing to PR description.