After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 652362 - (gcalctool) gcalctool needs to interpret comma (",") as a decimal dot (".")
(gcalctool)
gcalctool needs to interpret comma (",") as a decimal dot (".")
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
6.0.x
Other Linux
: Normal normal
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
: 666830 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-06-11 17:59 UTC by Patrik
Modified: 2014-06-08 20:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Convert commas and dots (periods) into decimal separator regardless the locale (1.02 KB, patch)
2011-12-21 13:57 UTC, pogliamarci
none Details | Review
Recognize keypad decimal key (652 bytes, patch)
2013-05-12 17:23 UTC, Pierre Ossman
none Details | Review

Description Patrik 2011-06-11 17:59:45 UTC
When using the Swedish (among others) keyboard layout, the numerical keyboard sends comma (",") as decimal dot ("."). Gcalctool does not accept the comma as a decimal dot and you need to type the dot from the main keyboard.

Suggestion: Translate comma into a dot, while typing.
Comment 1 pogliamarci 2011-12-21 13:57:57 UTC
Created attachment 204032 [details] [review]
Convert commas and dots (periods) into decimal separator regardless the locale
Comment 2 pogliamarci 2011-12-21 13:58:16 UTC
If I understood well, the problem comes out from the fact that your keypad sends a 'dot' that in your locale is the thousand separator instead than sending the decimal separator.

I've done some trials, and it seems that:
- the parser recognizes both commas and dots as decimal separator. For example, using the Italian locale, it works both by inserting a comma and a dot as dec sep (also if the standard decimal separator here is comma, the thousand separator is a space)
- but when the comma\dot\whatever is used in the locale settings as the thousands separator (e.g the dot in German and Spanish locale, or the comma in English), when inserting it it is thrown somewhere a GTK-warning "Invalid text buffer iterator" and nothing is inserted.
- usually, keypads send a "KP_Decimal" keycode that the code parses as the standard decimal separator of your locale (or at least my keyboard does so)

So, I tried to patch oddly the code to treat dots and commas as decimal separator REGARDLESS THE LOCALE, and converting into the standard dec sep. I don't know if this could have odd side effects somewhere in the code and\or make confusion in some locales with thousands separator (here in Italy we are used to see both comma and dot as decimal separator, I don't know in other countries...)
Comment 3 Patrik 2011-12-21 14:29:31 UTC
I looked at the patch and from that I can say that you understood me perfectly. Good!
Comment 4 Robert Roth 2012-04-11 08:15:17 UTC
*** Bug 666830 has been marked as a duplicate of this bug. ***
Comment 5 André Klapper 2012-06-11 07:03:41 UTC
> Suggestion: Translate comma into a dot, while typing.

Sounds very error prone for those using it as a thousands separator.
Comment 6 Patrik 2012-06-20 14:03:48 UTC
(In reply to comment #5)
> > Suggestion: Translate comma into a dot, while typing.
> 
> Sounds very error prone for those using it as a thousands separator.

It is easier to avoid comma when you don't need it, than a dot.
Comment 7 Pierre Ossman 2013-04-30 07:46:42 UTC
Any progress on this? The input really should follow keyboard layout rather than locale, as the current model makes the numpad almost useless.

I don't know how gtk does it, but X11 sends XK_KP_Separator rather than XK_KP_Decimal on these layouts. So the comment "/* Numeric keypad will often insert '.' regardless of locale */" is most likely incorrect.
Comment 8 Pierre Ossman 2013-05-12 17:23:17 UTC
Created attachment 243932 [details] [review]
Recognize keypad decimal key

This small patch makes sure that the keypad decimal key works no matter the layout. If you could so kindly apply. =)
Comment 9 Kyrylo V. Polezhaiev 2013-06-08 21:52:01 UTC
Hello,

Any progress?
Comment 10 Michael Catanzaro 2014-05-29 13:46:29 UTC
(In reply to comment #8)
> Created an attachment (id=243932) [details] [review]
> Recognize keypad decimal key
> 
> This small patch makes sure that the keypad decimal key works no matter the
> layout. If you could so kindly apply. =)

Arth, what do you think?  I don't have a number pad so I can't test this, but it looks like the patch causes Calculator to insert the correct localized decimal character when hitting the number pad decimal key, which I think should prevent confusion.
Comment 11 PioneerAxon 2014-06-08 20:10:34 UTC
Michael,

Neither do I have a full keyboard with me right now. Agreeing to the fact that it should work. Applying the fix.

Marking as resolved. Re-open the bug, if the patch doesn't work.