mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use decimal separator in setting for query
This commit is contained in:
parent
d1c69d601b
commit
4b09e07e09
1 changed files with 15 additions and 2 deletions
|
|
@ -35,7 +35,7 @@ namespace Flow.Launcher.Plugin.Caculator
|
|||
Context = context;
|
||||
_settings = context.API.LoadSettingJsonStorage<Settings>();
|
||||
_viewModel = new SettingsViewModel(_settings);
|
||||
|
||||
|
||||
MagesEngine = new Engine(new Configuration
|
||||
{
|
||||
Scope = new Dictionary<string, object>
|
||||
|
|
@ -54,7 +54,19 @@ namespace Flow.Launcher.Plugin.Caculator
|
|||
|
||||
try
|
||||
{
|
||||
var expression = query.Search.Replace(",", ".");
|
||||
string expression;
|
||||
|
||||
switch (_settings.DecimalSeparator)
|
||||
{
|
||||
case DecimalSeparator.Comma:
|
||||
case DecimalSeparator.UseSystemLocale when CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ",":
|
||||
expression = query.Search.Replace(".", ",");
|
||||
break;
|
||||
default:
|
||||
expression = query.Search;
|
||||
break;
|
||||
}
|
||||
|
||||
var result = MagesEngine.Interpret(expression);
|
||||
|
||||
if (result?.ToString() == "NaN")
|
||||
|
|
@ -76,6 +88,7 @@ namespace Flow.Launcher.Plugin.Caculator
|
|||
IcoPath = "Images/calculator.png",
|
||||
Score = 300,
|
||||
SubTitle = Context.API.GetTranslation("flowlauncher_plugin_calculator_copy_number_to_clipboard"),
|
||||
CopyText = newResult,
|
||||
Action = c =>
|
||||
{
|
||||
try
|
||||
|
|
|
|||
Loading…
Reference in a new issue