gt
gt copied to clipboard
Could locale modify `incl_space` and `placement` parameter?
Prework
- [x] Read and abide by gt's code of conduct and contributing guidelines.
- [x] Search for duplicates among the existing issues (both open and closed).
Proposal
I don't really know the mechanism of locale in gt.
But for example, in the "fr_CA" locale, the default would have to be incl_space = TRUE for fmt_percent().
For fmt_currency(incl_space = TRUE, placement = "right") would be the correct thing.
Would it be possible to have these two codes equivalent
# ideally those 2 would be equal
gt::fmt_percent(locale = "fr_CA", incl_space = TRUE)
gt::fmt_percent(locale = "fr_CA")
# ideally those 2 would be equal
fmt_currency(incl_space = TRUE, placement = "right", locale = "fr_CA")
fmt_currency(locale = "fr_CA")
Is there a way to accomplish this?
Edit:
the mechanism would have to go through a new function
for currency, would have to have
placement <- get_currency_placement(currency, placement, locale)
This doesn't seem very efficient because options would have to be added one by one..
Yes, this can be done and it’s actually something I’ve put off for far too long!
With these locale-specific parameters the default should be none and the locale would obtain the correct values from CLDR data. The arguments would then serve as overrides.