Lighthouse has built-in support for custom formatting for second,
millisecond and kilobyte placeholder values. These are not used in
DevTools and can safely be removed for now. Similar results can
be achieved with Intl.NumberFormat, or can be re-added on-demand.
Drive-by: Add tests for plural placeholders and wrong placeholder
usage.
R=tvanderlippe@chromium.org
Bug: 1231873
Change-Id: I6aa3859eeb94e7d1750ba23f555eef5f67a56a1a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3055233
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
`registerRequiredCSS`.
There are two main edge cases: multiple calls to
`this.registerRequiredCSS` and calls to properties of the object, e.g.
`this._widget.registerRequiredCSS`. I have added cases to the ESLint
rule to migrate these automatically.
In ESLint tests, the output is produced after only a single pass of
the rule. Keeping this in mind, the tests for multiple calls have
been broken down into multiple tests cases.
Bug: 1106746
Change-Id: If5a4827ec7230508c9208c6d23882499495be12a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3053744
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Kriti Sapra <kritisapra@google.com>
This CL adds a BUILD.gn and devtools_entrypoint to intl-messageformat.
DevTools modules can then import intl-messageformat via the standard
mechanism.
After this CL lands, the TS files in third_party/i18n can be migrated
to import from the entrypoint rather than the IntlMessageFormat
version that is part of the i18n-bundle. After that migration, the
i18n-bundle can also be simplified and no longer needs to include
IntlMessageFormat.
R=tvanderlippe@chromium.org
Bug: 1231873
Change-Id: Ie74378bf76211669fe088670ff2bfa8c970a2d3c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3046370
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
This CL upgrades the intl-messageformat package to version 9.8.0. This
is the first version that includes a modern ESM web bundle of the
library with all dependencies included.
Beware: After this CL lands, the i18n-bundle bundling process while be
temporarily broken, until third_party/i18n/localized-string-set is
switched over to use IntlMessageFormat directly from the package
instead of via the i18-bundle.
R=tvanderlippe@chromium.org
Bug: 1231873
Change-Id: Ia0d602f780491a05034e68f3f28e91d2b184d631
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3046367
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
This CL uses IntlMessageFormat directly to re-implement the existing
`LocalizedStringSet` class. As it is based on LH code now, its moved
to third_party.
The CL introduces a `RegisteredFileStrings` class intended as a
simple holder for UIStrings that lazily initializes
`LocalizedStringSets`. This indirection step is necessary because
UIStrings are registered at ES module instantiation time, at which
point neither the DevTools locale has been determined, nor
translation data been loaded.
Follow up CLs will move more of the i18n-bundle to TS, namely
placeholder formatting and locale management.
R=tvanderlippe@chromium.org
Bug: 1231873
Change-Id: I28ff84e39fda8cc880f55101bb4543891e681592
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3046361
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
It adds `import componentStyles from './component.css.js'` for any
registerRequiredCSS('front_end/component/component.css') call.
It also checks if there is an existing `wasShown()` method. If this
exists then it adds an extra line to add the
`this.adoptedStyleSheets = [componentStyles]` statement. Otherwise,
the `wasShown()` method is created and added.
Bug: 1106746
Change-Id: I7d0244d129fe0f4a50432fd7b53135760ae304ae
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3043915
Commit-Queue: Kriti Sapra <kritisapra@google.com>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
The `ConsoleMessage` that was created for `queryObjects(obj)` did not
have an execution context associated with it, which meant that it'd not
show at all as soon as the "Selected context only" setting in the
Console was enabled. This uses the `executionContextId` reported by the
`Runtime.inspectRequested` as of https://crrev.com/c/3046187 to properly
associate the `ConsoleMessage` with the execution context in which the
`queryObjects(obj)` expression was originally executed.
Drive-by-fix: Migrate the `QueryObjectRequested` event handler to the
new type safe event listeners mechanism.
Bug: chromium:1228674
Change-Id: I12328c6ebcca2aea38b14bd8f9d50ec76014073c
Fixed: chromium:1231521
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3046369
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
This CL prevents the delete-recreate cycle when a full update
of the issue view is requested. Instead, we preserve the items
that would be recreated and delete the ones that are not. For
the preserved items we schedule an update.
Fixed: chromium:1229570
Change-Id: Ib32e82f98737e6fd9f51a06eb650af2f5241662a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3045701
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Experiment titles do not have translations yet so attempting to
retrieve a translated title is a no-op. The upcoming stricter i18n
library will throw in this case instead of silently ignoring the
wrong API usage.
Follow-up work will introduce proper UIString entries for
experiments that can actually be translated, as well as change the
type of `Experiment#title` to be a localized string.
R=sigurds@chromium.org
Bug: 1232313
Change-Id: I96cca6171e925eff99bb78040fe0cf07cfb07c1d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3046366
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
The current intl-messageformat package checked into third_party comes
in 3 distribution formats: ESM, Node.js and UMD. Unfortunately all but
UMD has bundled the required dependency of intl-messageformat-parser.
Consuming the UMD bundle via a separate BUILD.gn + prebuilt is not
feasible. For the i18n re-write to use intl-messageformat directly,
we export it from the i18n-bundle for now. This allows us to create
instances via `new i18nBundle.MessageFormat(...)`.
R=tvanderlippe@chromium.org
Bug: 1231873
Change-Id: I490708afbf154310a5ff63df3403ff62bfefaedc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3045705
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
The helper functions were added to i18nImpl.ts where they mixed with
core i18n functions. Upcoming refactorings run into problems, where
the helper functions use core i18n that might not have properly been
initialized if function ordering in i18nImpl is not correct.
To prevent that from ever being an issue, the utilities are moved
into their own file, guaranteeing that core i18n is in a good state
when used.
R=tvanderlippe@chromium.org
Bug: None
Change-Id: Id2fe2e4ea9b299e34760c942b57ee378a78c57de
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3043953
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>