-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currency abbreviations #81
Conversation
Just a slight thing. CLDR disagrees on your point about French. CLDR don't contain it, but theoretically it continues with: Bd, Tn, Td |
Second thing; the east Asian languages; Korean, Japanese and Chinese (and possibly more) uses groupings of 4. So the following: And like for French, the continuation that is excluded in CLDR: 京, 垓, 秭, 穰, 沟, 涧, 正, 载 Then you also got the Hindi pattern: |
Thanks for pointing the CLDR, it should effectively be the reference for this implementation ! However, I'm note sure we should implement the continuation if the CLDR doesn't indicate it. Shouldn't we stick with the standard? |
You should certainly stick to the CLDR, that is the best bet. Then everything will appear as expected, between d3-format and CLDR. I can see the CLDR terminating at T/Bn because there's no proper abbreviation of quadrillion in English; Q could be used, but it can be mixed up with quintillion, so that's where the single letter unambiguous list ends. CLDR is primarily made by American English speaking people (that's why "en" and not "en-US" is American English, and "en-001" where "001" stands for every single country on earth with no exception, excludes countries using American English in CLDR). Otherwise we might have seen Bd, Tn, Td in French, as that's a very logical continuation. ... But that's me ranting at stupid decisions in CLDR xD |
Two reservations re: the proposed French locale (on top of @Liggliluff’s).
I'm not sure how these remarks might apply to other languages. A few refs.:
|
Thanks for the feedback and references! I'll try to take this into account in my spare time soon. |
These functons will be used todetermine which prefixes will be used when formatting currencies. Common prefixes are for thousands (K), millions (M), billions (B) and trillions (T).
Implement en, fr, de, es, it and ln locales See https://github.com/PrestaShop/PrestaShop/blob/develop/localization/CLDR/core/common/main/<locale>.xml for reference
e03ec09
to
76c6681
Compare
I took some minutes to stick to CDLR for en, fr, it, es, de, and nl locales (76c6681), and rebase the PR.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -2,5 +2,6 @@ | |||
"decimal": ".", | |||
"thousands": ",", | |||
"grouping": [3], | |||
"currency": ["£", ""] | |||
"currency": ["£", ""], | |||
"currencyAbbreviations": ["", "K", "M", "B", "T"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From Language Matters: Millions, Billions and Other Large Numbers
The most commonly seen short forms for thousand, million, billion and trillion in North America and the United Kingdom, respectively, are outlined in the table below.
Might we consider changing locale/en-GB.json
to match these?
"currencyAbbreviations": ["", "k", "m", "bn", "tn"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in #96
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these. I removed them from this PR originally (7ee5a2c) because they are not indicated in the CDLR, but I think they should be!
Suggest to close this in favor of #96 |
closed in favor of #96 |
Hi,
I found the use case described in #71 quite common, and I agree that replacing the SI-prefixes is just a workaround, not a definitive solution. Therefore, I worked a bit to add a
K
type that will use common currency abbreviations (K for thousands, M for millions, B for billions, T for trillions). It reuses the logic of thes
type, with the small difference that the count of abbreviations can vary with the locale.The abbreviations can be customized in locale definition under the property
currencyAbbreviations
, so the billionB
in US would becomebn
is GB.Their count can also vary : in French, there is no abbreviation for trillions (T), so 1.22T will be formatted as 1220Mrds (Mrds being the french abbreviation for billions).
Closes #71