Open ockham opened 4 years ago
It'd be great if we could replace usage of i18n-calypso's numberFormat by Intl.NumberFormat
That's also the approach we took in Jetpack:
An alternative may be to bring this functionality to Core itself, as discussed here: https://github.com/WordPress/gutenberg/issues/22628
While Core may not have much use for a function used to localize the display of currency amounts (this seems to be plugin territory), I think it'd be useful to have a general number formatting function there.
This issue is stale because it has been 180 days with no activity. You can keep the issue open by adding a comment. If you do, please provide additional context and explain why you’d like it to remain open. You can also close the issue yourself — if you do, please add a brief explanation and apply one of relevant issue close labels.
cc @Automattic/i18n and @yuliyan in case this is something interesting to consider.
First brought up by @tyxla here: https://github.com/Automattic/wp-calypso/pull/28846#pullrequestreview-178381258
As we're moving to use
@wordpress/i18n
overcalypso-i18n
,numberFormat
is one of the tools that is holding us back, as it's still used by a lot of code. See e.g. this JP PR by @jeherve that removes the expliciti18n-calypso
dependency, but still retains it in its lockfile, as it's required transitively by@automattic/format-currency
.It'd be great if we could replace usage of i18n-calypso's
numberFormat
byIntl.NumberFormat
, which seems to be widely supported.Note that the API (function signature) is quite different: e.g.
Intl.NumberFormat
requires an explicit locale arg.cc/ @Automattic/team-calypso