thewca / worldcubeassociation.org

All of the code that runs on worldcubeassociation.org
https://www.worldcubeassociation.org/
GNU General Public License v3.0
326 stars 175 forks source link

Locale based formatting for the currency symbol #3206

Open viroulep opened 6 years ago

viroulep commented 6 years ago

When I introduced the currency formatting I kind of remember that I had to override some setting to have the '€' sign displayed after the price. This is not the case anymore because we probably changed the library in charge of displaying the fee(?), so I looked into what we're using now. Looks like the gem we're using is indeed following the iso specifications, which states:

The euro sign is followed by the amount without space:
a sum of €30
NB:
The same rule applies in Dutch, Irish and Maltese. In all other official EU languages the order is reversed; the amount is followed by a hard space and the euro sign:
une somme de 30 €

This kind of made me laugh, as in all the countries using euro but 3 we display the sign after, yet the standard decided display it before...

Anyway the "correct" way to handle this is not to enforce it either way, but rather use a locale-based configuration.

Luckily this has been started over at RubyMoney/money#712, so I'll watch this issue and take care of bringing in/use the change when it's available.

AlbertoPdRF commented 6 years ago

I see that the PR to fix that issue has already been merged: https://github.com/RubyMoney/money/pull/783

viroulep commented 6 years ago

I saw that but I believe that's just a first step adding a formatting method to the Money class, but I'm not sure if the "locale to sign position" part is done.

I'll play a bit locally, but I'd rather not add a "number.currency.format.symbol_position" to our locale files, if it's going to be standardized somewhere (but as you noticed it would probably work).

jsaraiva commented 5 years ago

Just found this, navigating from the Ruby Money issue.

Even though this issue is not recent, a small note: "This kind of made me laugh, as in all the countries using euro but 3 we display the sign after, yet the standard decided display it before..."

The "sign before" is not the standard. You saw that text, with the "sign after" exception, because you were looking at the English version of the text. If you access the corresponding page in Portuguese, for example, at http://publications.europa.eu/code/pt/pt-370303.htm#position (use Google Translate), you'll see that the text states the symbol comes after, with the exception being for those 3 which place the sign before.