Skip to content
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

Decimal points changed to commas #3

Open
joe-ercolino opened this issue Dec 15, 2022 · 2 comments
Open

Decimal points changed to commas #3

joe-ercolino opened this issue Dec 15, 2022 · 2 comments

Comments

@joe-ercolino
Copy link

Hi

This is a great Web App. I use it daily instead of the system calculator.

In my case the results are displayed with commas instead of decimal points regardless of what I have used in the input. I suppose that this corresponds to my Chrome preferences. It is possible to match the decimal characters of the output with those in the input? Or at least it is posible to change the results decimal character to points without changing the system or browser's preferences?

Thanks in advanced.

@SteveRidout
Copy link
Owner

Thanks for the suggestion! Since the tool doesn't have a settings page right now, I've made it so that you can do this by manually setting localStorage. If you open your browser's dev tools and in the JS console type the following it'll change the locale to German using commas for decimal points:

localStorage["locale"] = "de-DE"

And if you change the locale to US it'll use periods for decimal points:

localStorage["locale"] = "en-US"

This value is fed into the browser's toLocaleString() function to generate the number: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString

After running the above commands you'll need to reload your tab for the change to take effect

It'll only affect the output in the right hand column, you can't change the accepted format for numbers which you type in the left hand column.

By the way, this is all relevant to the app running at https://notepadcalculator.com, which is actually different from the early prototype code in this repo.

Hope that helps!

@SteveRidout
Copy link
Owner

I forgot to deploy the change before writing my message yesterday, sorry! The change is now live!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants