-
Notifications
You must be signed in to change notification settings - Fork 2k
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
i18n: Deprecate use of number-format-compact
utility functions. Use numberFormat
instead (for now)
#98533
base: trunk
Are you sure you want to change the base?
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~236 bytes removed 📉 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~5118 bytes removed 📉 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~2225 bytes removed 📉 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
@@ -182,6 +182,7 @@ I18N.prototype.numberFormat = function ( number, options = {}, forceLatin = true | |||
minimumFractionDigits: decimals, // default is 0 | |||
maximumFractionDigits: decimals, // default is the greater between minimumFractionDigits and 3 | |||
// TODO clk numberFormat this may be the only difference, where some cases use 2 (they can just pass the option to Intl.NumberFormat) | |||
...( options?.notation && { notation: options.notation } ), |
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.
This will change next to simply spread the full options
here
6957664
to
c671734
Compare
7f44aba
to
0fff918
Compare
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
Related to #98405
Related to #46564
Proposed Changes
This is a follow-up to #98405 and continuing on the path to either deprecate or centralize i18n-calypso
numberFormat
. It is part of a series of PRs that complete the refactor incrementally. See pxLjZ-9Eg-p2 for details on how we'll approach deprecation ofnumberFormat
(or alternatively a general refactor around it).formatNumberCompact
andformatNumberMetric
utilities from core Calypso and@automattic/components
numberFormat
with "compact" notation and adds a few tests to address the force of latin numeric for localised numbering systemsWhy are these changes being made?
We only really need one way of formatting numbers in the codebase. Maybe one wrapper, or maybe one straight-up use of a vanilla API. Unless there is a good reason to not do so, we will pursue this path.
Testing Instructions
Examples of compact / non-compact and Count usage:
/stats/day/:site
that number in views etc. render correctly in compact form/plugins/:site
that number of installs renders in compact form (Count
component)/read
sidebar > organizations (Count
component)Pre-merge Checklist