Contributions page does not accept non-en-US decimal points

VERIFIED FIXED in 5.0.8

Status

P3
minor
VERIFIED FIXED
9 years ago
3 years ago

People

(Reporter: wenzel, Assigned: wenzel)

Tracking

unspecified
5.0.8

Details

Attachments

(4 attachments, 1 obsolete attachment)

(Assignee)

Description

9 years ago
Created attachment 387400 [details]
Screenshot

See attached screenshot: When setting up contributions, the localized decimal point should be supported.

I suggest we always support the dot, and in addition to that allow whatever the local decimal point is (in German, that would be a comma). localeconv [1] knows.

Marking this major, because non-English users will stumble across this almost inevitably.

[1] http://us2.php.net/manual/en/function.localeconv.php
(Assignee)

Comment 1

9 years ago
In fact, I am unsure why we use a regex for valid money? is_numeric does the separator-thing automatically. Note though that it would not support the point anymore if the correct one for your locale is a comma. May need to str_replace the point to the appropriate local decimal separator before checking with is_numeric.
We're only supporting USD for this initial launch as we're just testing it out.  I thought there was a "(USD)" label after the box but apparently not.

Would adding that label be enough for people to realize they need to use decimal points?
(Assignee)

Comment 3

9 years ago
Sorry, don't want to sound self-centered, but I don't think all people know that English-speaking countries use a point as a decimal point. I could change the German error message for invalid numbers so that it shows "0.00", which would hopefully make people realize that they need to write it like that, but it feels like a duct-tape fix to me :-/

From what I can tell, however, all other localizers that have translated the string preserved the decimal point rather than localizing the value.

I'll change it in the German l10n, but I'd feel bad calling the issue FIXED after this...
(Assignee)

Comment 4

9 years ago
I changed it to "0.00" etc in de: r29515.
Jeff added an example in r29519.  Since we're only supporting USD for this run I'm calling this fixed (or wontfix if you like).  If/when we support other currencies we'll make the system more robust, including accepting appropriate decimal points.
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED

Comment 6

9 years ago
(In reply to comment #5)
> Jeff added an example in r29519.  Since we're only supporting USD for this run
> I'm calling this fixed (or wontfix if you like).  If/when we support other
> currencies we'll make the system more robust, including accepting appropriate
> decimal points.

Although I was a bad student in the German class, I would like to point out that the fact that USD is the only supported currency here has nothing to do with this issue.  In some languages including German, the decimal separator in a number is represented by a comma no matter which unit the number is in.  This is just in the same way that we do not write “12,34 EUR” in the American/British English.
See e.g. http://news.google.com/news?ned=de&hl=de&q=USD

For now, the current hack (writing “0.00”) is probably much better than no hack.  But I wish that this bug will be really fixed in future.

> msgstr "Sollte eine positive Zahl zwischen 0.00 and 99.99 sein."
and -> und?
(Assignee)

Comment 7

9 years ago
(In reply to comment #6)
> > msgstr "Sollte eine positive Zahl zwischen 0.00 and 99.99 sein."
> and -> und?

Haha, wow, thanks ;) r29546.

I also agree that this has nothing to do with the currency. Commas stay commas :)

Wil, should we add this to an upcoming milestone? I can probably write a simple patch.
if you like
(Assignee)

Comment 9

9 years ago
(In reply to comment #8)
> if you like

Oh, you know I do.
Severity: major → minor
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 5.0.7 → 5.0.8

Updated

9 years ago
Assignee: nobody → fwenzel
Priority: -- → P3
(Assignee)

Comment 10

9 years ago
Created attachment 389913 [details] [diff] [review]
Patch, rev. 1

This patch converts localized "commas" to the point we currently require on the fly.
Attachment #389913 - Flags: review?(clouserw)
(Assignee)

Updated

9 years ago
Status: REOPENED → ASSIGNED
Comment on attachment 389913 [details] [diff] [review]
Patch, rev. 1

typo: $local_info
Attachment #389913 - Flags: review?(clouserw) → review-
(Assignee)

Comment 12

9 years ago
Created attachment 389969 [details] [diff] [review]
Patch, rev. 2

Whoops. Thanks.
Attachment #389913 - Attachment is obsolete: true
Attachment #389969 - Flags: review?(clouserw)
Attachment #389969 - Flags: review?(clouserw) → review+
(Assignee)

Comment 13

9 years ago
r30240, thanks.
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago9 years ago
Keywords: push-needed
Resolution: --- → FIXED
Created attachment 390272 [details]
Post-fix screenshot, showing "1,25" as the suggested value
Created attachment 390295 [details]
Post-fix screenshot, part deux, showing that "1,25" gets rewritten as "1.25"

Is it expected that, even on /de/, the "1,25" I entered gets normalized back to "1.25"?
Verified FIXED per the scope of this bug and comment 14; comment 15, if desired, should be a separate bug.
Status: RESOLVED → VERIFIED
(Assignee)

Comment 17

9 years ago
(In reply to comment #16)
> Verified FIXED per the scope of this bug and comment 14; comment 15, if
> desired, should be a separate bug.

I agree, thanks. For the scope of this bug, normalizing back to '.' is expected. I intentionally wanted to allow localized decimal points to be *entered* without screwing with the PayPal side of things.

Choosing the right decimal point when displaying it on the page, that is probably indeed another bug.
Keywords: push-needed
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.