Flow.Launcher icon indicating copy to clipboard operation
Flow.Launcher copied to clipboard

BUG: Calculator does not use system locale for decimal separator

Open guntern opened this issue 2 years ago • 22 comments

Checks

  • [X] I have checked that this issue has not already been reported.

Problem Description

For the calculator I use the setting for "Decimal Separator" to be "Use system locale". In my Windows settings this is set to ",". However, the calculator uses "." as decimal separator. Only when explicitly setting to "Comma (,)" it uses a ",". Normally I could work around it. But it gets really annoying when trying to copy the result to Excel, which then thinks it got provided with a date rather than a number.

To Reproduce

  1. Check that Calculator plugin settings are set to "Use system locale"
  2. In Windows settings the decimal separator should be set to ","
  3. Try to do calculations in flow launcher with decimal numbers. Only numbers entered with "." are recognized and results are presented with "." rather than ",".

Screenshots

No response

Flow Launcher Version

1.13.0

Windows Build Number

10.0.19045.2486

Error Log

No response

guntern avatar Feb 10 '23 07:02 guntern

Hi I have tested this feature and can confirm that it is working correctly. Please restart the FL using Restart Flow Launcher command after you set the comma(,) as the Decimal symbol in Windows settings.

z1nc0r3 avatar Feb 11 '23 08:02 z1nc0r3

That is weird. My setting in Windows has always been set to comma. It was working until a recent update of Flow Launcher. And then it stopped working. So I restarted flow launcher quite often already (system restarts as well as restarts for plugin installation)

I did a new test:

  1. set Windows settings to dot (.)
  2. restart flow launcher --> still accepting dot as decimal separator
  3. set Windows settings back to comma (,)
  4. restart flow launcher --> still only accepting dot as decimal separator
  5. double checking that in the calculator settings system locale is chosen

guntern avatar Feb 16 '23 13:02 guntern

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 03 '23 01:04 github-actions[bot]

Hi, I would like to check how the status of this issue is? Is there anything I could test to help solve it? Best regards,

guntern avatar Apr 03 '23 17:04 guntern

Please update to the latest version and check if this issue remains after restarting Flow. I cannot reproduce this issue.

VictoriousRaptor avatar Apr 04 '23 02:04 VictoriousRaptor

I checked the updates and I am at the newest version. And the issue still remains. It is actually the same on two machines of mine. So I am really wondering, what the difference between my setup and yours is.

I will try something else, once I have more time again: I will look into the code myself. Could you point me to the section of code, which reads the system locale setting and which sets the symbol used within flow launcher depending on the setting chosen (in the plugin settings as well as the system settings)? Thank you very much.

guntern avatar Apr 05 '23 20:04 guntern

Check the folder Plugins and inside it you can see a folder called flow.plugin.calculator and Main.cs inside that.

taooceros avatar Apr 05 '23 20:04 taooceros

Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

BTW have you tried resetting the settings of calculator plugin by deleting its settings.json?

VictoriousRaptor avatar Apr 07 '23 01:04 VictoriousRaptor

Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

BTW have you tried resetting the settings of calculator plugin by deleting its settings.json?

I deleted the calculator settings.json and also the calculator section in the global settings.json. Each separately with a restart of flow launcher. No change.

I noticed though that the plugins directory is named caculator instead of calculator, but this most probably just a typo and not related to the issue.

Check the folder Plugins and inside it you can see a folder called flow.plugin.calculator and Main.cs inside that.

Hmmm....C#. This will require a bit more time to set this up.

guntern avatar Apr 07 '23 18:04 guntern

I think I figured it out. Luckily without having to compile the plugin or even the whole flow launcher. Just a little bit more than a c#-helloworld and reading about DefaultThreadCurrentCulture (https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.defaultthreadcurrentculture?view=net-7.0) brought me on the right track.

Here you set the DefaultThreadCurrentCulture depending on the language setting of flow.launcher, which happens for me to be English. Thus here it is not using my normal German setting with ,, but the English setting with ..

I verified this. When changing my flow launcher language in the settings to German and setting in the Calculator plugin to use system locale (or its German version then), the calculator actually uses the ,.

So the question is, whether the DefaultThreadCurrentCulture has certain advantages, when it is set to the language specified in flow launcher. Probably to ensure everything in English in all queries. But the system local settings should probably be checked against my standard system cutlure setting. Well at least that's what I would expect from the setting use system locale.

guntern avatar Apr 08 '23 19:04 guntern

I noticed though that the plugins directory is named caculator instead of calculator, but this most probably just a typo and not related to the issue.

yeah likely a typo and not related....maybe we shall fix it

So the question is, whether the DefaultThreadCurrentCulture has certain advantages, when it is set to the language specified in flow launcher. Probably to ensure everything in English in all queries. But the system local settings should probably be checked against my standard system cutlure setting. Well at least that's what I would expect from the setting use system locale.

@VictoriousRaptor I notice the change is from your pr. Any particular reason for that?

Although I think majorly this is a decision problem. We want plugins to align the language set by flow rather than the system language (there seems to be one api for getting the system culture), which has been discussed before when porting the windows setting plugin. @onesounds what do you think?

taooceros avatar Apr 08 '23 20:04 taooceros

@taooceros I'll ask the question again to make sure I understand it correctly. So the "use system locale" setting in the calculator follows the language setting in flow, not windows?

If my understanding is correct,

  1. I had always assumed this settings followed those of the Windows system. Based on the name of the menu, this is how it should work, and from a UX perspective, this is the most normal behavior.
  2. If it's a simple task, Let's change it to behave like 1.
  3. If it's tricky to implement, I think we could remove that setting or just rename it to something like "Use Flow's language locale setting"... But for things like the decimal separator, it's a pain to set, and I think it's common practice to follow the system setting for this value.

and by default, Flow's plugins language should follow the settings in Flow itself, not the Windows system (except for things like calculators and window settings). This is because the system language may not be the user's primary language.

Has raptor changed anything recently? I don't see any issues on my end,

onesounds avatar Apr 08 '23 20:04 onesounds

So the "use system locale" setting in the calculator follows the language setting in flow, not windows?

Seems like so

If it's tricky to implement, I think we could remove that setting or just rename it to something like "Use Flow's language locale setting"... But for things like the decimal separator, it's a pain to set, and I think it's common practice to follow the system setting for this value.

I agree, but I think it is not so hard? This seems to be the correct api to use. https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.installeduiculture?view=net-7.0

Has raptor changed anything recently? I don't see any issues on my end,

No I think the behavior after and before his change is identical

taooceros avatar Apr 08 '23 21:04 taooceros

I noticed though that the plugins directory is named caculator instead of calculator, but this most probably just a typo and not related to the issue.

yeah likely a typo and not related....maybe we shall fix it

So the question is, whether the DefaultThreadCurrentCulture has certain advantages, when it is set to the language specified in flow launcher. Probably to ensure everything in English in all queries. But the system local settings should probably be checked against my standard system cutlure setting. Well at least that's what I would expect from the setting use system locale.

@VictoriousRaptor I notice the change is from your pr. Any particular reason for that?

It was to set flow's culture info to user specified language.

VictoriousRaptor avatar Apr 09 '23 01:04 VictoriousRaptor

No I think the behavior after and before his change is identical

I am not 100% sure about this. At some point the behavior changed, but I cannot exactly recall when. I never had issues with this topic until some point.

Anyway, I lik the thinking of @onesounds. I would expect the calculator to use my windows settings, so it works correctly out of the box, without the necessity to fiddle with some settings.

Furthermore, I do not like the choice to use the language setting of FlowLauncher to select a locale/culture. This comma/dot-issue is one story. But associated with this is also currency, if it was used by some plugin. You only have the ability to select English as language, which does not separate for american english with USD or australian english with AUD or guys like myself, which choose English for other reasons (maybe FlowLauncher is not translated to their language) with some complete different setup.

guntern avatar Apr 09 '23 19:04 guntern

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jun 01 '23 02:06 github-actions[bot]

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jul 19 '23 02:07 github-actions[bot]

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Sep 13 '23 01:09 github-actions[bot]

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Nov 06 '23 01:11 github-actions[bot]

What is going to happen to this issue? Thinking about it again it seems that the calculator issue is only a symptom of something bigger. Would the choice regarding the locale get an own issue?

guntern avatar Nov 08 '23 19:11 guntern

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Dec 24 '23 01:12 github-actions[bot]

This issue was closed because it has been stale for 7 days with no activity. If you feel this issue still needs attention please feel free to reopen.

github-actions[bot] avatar Dec 31 '23 01:12 github-actions[bot]

Thank you very much, @jjw24 @VictoriousRaptor . Now it's waiting time for the official update :-)

guntern avatar May 27 '24 05:05 guntern