Audit culture bugs (#7707)

* Added comments and fixed CultureInfo /  StringComparison where appropriate

* Addressed comments

* Fixed comment
This commit is contained in:
Avneet Kaur
2020-10-30 16:43:09 -07:00
committed by GitHub
parent bd34127cd4
commit 2c5b9b4d52
54 changed files with 160 additions and 28 deletions

View File

@@ -15,6 +15,7 @@ namespace Microsoft.Plugin.Calculator
public CalculateResult Interpret(string input)
{
// Using CurrentCulture this is user facing
return Interpret(input, CultureInfo.CurrentCulture);
}

View File

@@ -35,6 +35,7 @@ namespace Microsoft.Plugin.Calculator
try
{
// Using CurrentUICulture since this is user facing
var result = CalculateEngine.Interpret(query.Search, CultureInfo.CurrentUICulture);
// This could happen for some incorrect queries, like pi(2)

View File

@@ -27,6 +27,7 @@ namespace Microsoft.Plugin.Calculator
return new Result
{
// Using CurrentCulture since this is user facing
Title = roundedResult?.ToString(CultureInfo.CurrentCulture),
IcoPath = iconPath,
Score = 300,
@@ -45,6 +46,7 @@ namespace Microsoft.Plugin.Calculator
{
try
{
// Using CurrentUICulture since this is user facing
Clipboard.SetText(roundedResult?.ToString(CultureInfo.CurrentUICulture.NumberFormat));
ret = true;
}