Reland "Use Intl.NumberFormat for time and byte formatting"
This reverts commit 55ffe2fb876bae23ee9b83f1b7824b2021834c12.
Reason for revert: fixed conflicting internal code (NPP)
Original change's description:
> Revert "Use Intl.NumberFormat for time and byte formatting"
>
> This reverts commit 6b3449efbc12670977cc04ecf0f1c66148f2df5d.
>
> Reason for revert: currently failing the auto roller: https://ci.chromium.org/ui/p/devtools-internal/builders/try/devtools_frontend_linux_rel/b8731890377373202833/overview
>
> Original change's description:
> > Use Intl.NumberFormat for time and byte formatting
> >
> > TimeUtilities now uses Intl.NumberFormat (instead of UIStrings),
> > and bytesToString now uses Intl.NumberFormat (instead of non-locale
> > aware strings). Additionally, bytesToString is now under the i18n
> > module.
> >
> > Impacts of this change:
> >
> > * use Chrome ICU locale data to format, rather than human translators,
> > which allows us to be more accurate in regards to unit display style
> > (narrow vs short vs long)
> > * group separators (ex: thousands decimals in english) are now present
> > * slight change to rounding behavior - Intl.NumberFormat defaults to
> > "halfExpand", which rounds away from zeroes to break ties. Previously
> > we just truncated
> >
> > See go/cpq:i18n-units-design
> >
> > Bug: 372723536
> > Change-Id: Iff05ca9ff01213660d64ca88fadb613296153fa9
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5981156
> > Reviewed-by: Simon Zünd <[email protected]>
> > Commit-Queue: Connor Clark <[email protected]>
> > Reviewed-by: Benedikt Meurer <[email protected]>
> > Reviewed-by: Paul Irish <[email protected]>
>
> Bug: 372723536
> Change-Id: I82f74ae04729b9f6c514d7e186572a8ffade30cd
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6003765
> Commit-Queue: Kim-Anh Tran <[email protected]>
> Bot-Commit: Rubber Stamper <[email protected]>
Bug: 372723536
Change-Id: I1d6f3ddc5fb0cc97a88b79e27a74ba29c134c83f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6005878
Commit-Queue: Connor Clark <[email protected]>
Reviewed-by: Paul Irish <[email protected]>
diff --git a/front_end/panels/network/NetworkLogView.ts b/front_end/panels/network/NetworkLogView.ts
index 58596a8..cf51243 100644
--- a/front_end/panels/network/NetworkLogView.ts
+++ b/front_end/panels/network/NetworkLogView.ts
@@ -1272,26 +1272,26 @@
this.summaryToolbarInternal.appendSeparator();
appendChunk(
i18nString(UIStrings.sSTransferred, {
- PH1: Platform.NumberUtilities.bytesToString(selectedTransferSize),
- PH2: Platform.NumberUtilities.bytesToString(transferSize),
+ PH1: i18n.ByteUtilities.bytesToString(selectedTransferSize),
+ PH2: i18n.ByteUtilities.bytesToString(transferSize),
}),
i18nString(UIStrings.sBSBTransferredOverNetwork, {PH1: selectedTransferSize, PH2: transferSize}));
this.summaryToolbarInternal.appendSeparator();
appendChunk(
i18nString(UIStrings.sSResources, {
- PH1: Platform.NumberUtilities.bytesToString(selectedResourceSize),
- PH2: Platform.NumberUtilities.bytesToString(resourceSize),
+ PH1: i18n.ByteUtilities.bytesToString(selectedResourceSize),
+ PH2: i18n.ByteUtilities.bytesToString(resourceSize),
}),
i18nString(UIStrings.sBSBResourcesLoadedByThePage, {PH1: selectedResourceSize, PH2: resourceSize}));
} else {
appendChunk(i18nString(UIStrings.sRequests, {PH1: nodeCount}));
this.summaryToolbarInternal.appendSeparator();
appendChunk(
- i18nString(UIStrings.sTransferred, {PH1: Platform.NumberUtilities.bytesToString(transferSize)}),
+ i18nString(UIStrings.sTransferred, {PH1: i18n.ByteUtilities.bytesToString(transferSize)}),
i18nString(UIStrings.sBTransferredOverNetwork, {PH1: transferSize}));
this.summaryToolbarInternal.appendSeparator();
appendChunk(
- i18nString(UIStrings.sResources, {PH1: Platform.NumberUtilities.bytesToString(resourceSize)}),
+ i18nString(UIStrings.sResources, {PH1: i18n.ByteUtilities.bytesToString(resourceSize)}),
i18nString(UIStrings.sBResourcesLoadedByThePage, {PH1: resourceSize}));
}