Allow , and . as decimal separator on INPUT
In short: Who will ever enter "1,000" to represent 1000?
Hence it makes sense to treat 2,5 and 2.5 both as 2 and 1/2 on input.
Output should be according to selected number-format locale.
Corner-Case "Paste" of selected text: Apply selected number-format locale.
// Context and Problem:
I am tri-lingual English, French, German.
For me - and I guess for many people living / working across number-format systems - it is that if I THINK in English (as I just wrote English or spoke English) I want to enter 12.5 represent 12 + 1/2 and if in a German phone conversation I need to calculate something, I will enter 12,5 to represent 12 + 1/2 !!
English uses a ., German uses , and French I can't remember and what locale am I currently in / did I setup, I don't want to bother ;)
// The Solution (simple and elegant):
I once found a linux calculator that was (without any setting) by default agnostic to 0.5 and 0,5 as both were being interpreted as 1/2.
This is really a GREAT feature.
Because: Who ever enters: 1,000 ( to represent 1000) ???
Everyone will enter 1000, no?
So it makes really sense if you think about it as the "thousand separator" making numbers easily readable can still be used in the OUTPUT of numbers so to properly DISPLAY them!
If you agree then you could simply interpret , and . in input as decimal separator.
And STILL use the number-format locale for proper OUTPUT. So if you set the locale to US in preferences and you enter 1000 you see 1,000
And if you enter 0,5 you see 0.5
(and if you enter 0.5 you see 0.5)
And if you set the locale to Germany and you enter 1000 you see 1.000 and if you enter 0.5 you see 0,5
(and if you enter 0,5 you see 0,5)
IMHO this would be the most elegant and also intuitive solution as through the output in peoples usual number-format they would understand.
// Alternative Solution:
A bit more overhead, but even more flexibility for the user to chose his favorite flavour:
Otherwise an option to toggle between the current implementation and the ,/. agnostic (, and . are exchangable on input) version.
// Corner Case:
I opt for the simple and elegant Solution, as I really don't see anyone entering 1,000 except for cases where you copy+paste a number from a text selection.
in which case on a "paste" you could either apply the currently set locale (this should probably already be implemented that way anyways?!)
or /ask/ the user if the user wanted to enter 1 with 3x0 decimals or 1000 ;)
But I would opt with applying the number-format locale set in preferences on pasting.
marked this post as