Closed flack closed 2 years ago
Hi, this is my first time trying to contribute to Open Source and this seems like a good bug to start. If no one is working on this, can I take it on?
@karlsauter please feel free to open a Pull Request. We will happy review and consider the change.
Hey @kjohnson, I found the code, made the change and it works. But different countries and regions format currency differently, some add spaces, others don't. A better solution would be to use the Intl.NumberFormat function, and ask the user their locale settings.
Besides, php formats currencies differently depending on the currency. For example CHF has a space before it, but the Polish Zloty doesn't.
Any thoughts?
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 14 additional days.
Code is /includes
is now considered legacy code and is being slowly replaced in /src
.
Closing this issue as we migrate functionality to /src
.
@kjohnson Maybe I'm missing something, but this ticket is about JS not rendering correctly, i.e. this function:
So removing includes/
won't change the issue
User Story
As a user, I want to see the properly formatted amount so that I can be sure about what I'm about to donate.
Details
In PHP, all currencies that are not explicitly listed get a space between the amount and the symbol:
https://github.com/impress-org/givewp/blob/194015ed4583da3fa84c7fe9be21a156649edd95/includes/currency-functions.php#L309
So when I open a donation form
give-final-total-amount
contains a string like this (because it's rendered by PHP):when I click a donation level or manually enter a sum, the display changes to this (because it's rendered by JS):
which is ugly and inconsistent
Expected Behavior
The amounts should be rendered consistently throughout the site, the JS and PHP renderer should produce the same result
Steps to Reproduce
Visuals
rendered by PHP:
rendered by Javascript:
Acceptance Criteria