Skip to content
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

Let users customize order of suffixing and currency (or other eurs) #1805

Open
2 tasks done
maxheld83 opened this issue Jul 18, 2024 · 2 comments
Open
2 tasks done

Let users customize order of suffixing and currency (or other eurs) #1805

maxheld83 opened this issue Jul 18, 2024 · 2 comments

Comments

@maxheld83
Copy link

Prework

Proposal

Currently,

gt::vec_fmt_currency(1000L, "EUR", suffixing = TRUE, placement = "right")
# [1] "1.00EURK"

Where the (German/European?) expectation would be something like "1.00kEUR" or "1.00TEUR" (for thousands).

Also strikes me that in some other contexts outside of currencies, you'd put the suffix before the unit, not after (milliampers, "mA", not "Am").

So it might be cool to let users customize this order.

@obsaditelnost
Copy link
Contributor

obsaditelnost commented Sep 4, 2024

I assume this is rather a bug instead of intended behaviour. Right now I can think of no use-case to split the number itself and a suffix in favour of a symbol of any kind.

All other formatting functions that use symbols ("%" for example) internally set "suffixing" to FALSE before calling fmt_symbol. But even if they'd apply suffixing, "2k %" would make more sense than "2 %k"

I'd suggest to rework the order here:
https://github.com/rstudio/gt/blob/33e9d62bc8fccc480c603fc85e27011b5501939d/R/format_data.R#L1190C1-L1210C64

What do you think @rich-iannone ?

@rich-iannone
Copy link
Member

A number/currency overhaul needs to be done here. First, the short/compact numbers aren't localized. The currency symbol placement also isn't localized. The combination of this, a short/compact currency pattern also needs to be added. The data is available for all of this. For your specific example (in the "de" locale), this is what it should ideally look like:

https://github.com/unicode-org/cldr-json/blob/d38478855dd8342749f0494332cc8acc2895d20d/cldr-json/cldr-numbers-full/main/de/numbers.json#L121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

4 participants