Commit Graph
22 Commits
Author SHA1 Message Date
Kalon Hinds 1ed85887c9 Detect URL-only strings in localizability check script
This patches adds a localizability check that detects and errors on
URL-only strings that are localized. Since URLs cannot be translated
there's no purpose in creating and maintaining grdp file entries for
them.

Change-Id: I3228f2935f54c839833822fd61374d3ce4ea68c7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2319836
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Commit-Queue: Kalon Hinds <kahinds@microsoft.com>
2020-07-28 00:00:20 +00:00
Christy Chen 465b102104 [Loc] Fix <LOCKED> and <ex> get removed when messages move across grdps
When the presubmit moves a message from one grdp file to another, the <ph name=LOCKED> and <ex> tags are lost because all the messages are re-created from the frontend version of the string.
This change preserve the grd version of the strings that contains all the tags and use it when the messages are moving across different grdp files.

To test this:
In DeviceModeToolbar.js Line 351
Change
ls`Close DevTools`
To
'Close DevTools'

In WarningErrorCounter.js Line 163
Change
ls`Issues pertaining to ${issues} operation detected.`
To
ls`Close DevTools`

Run presubmit and see the tags are preserved.

Bug: 1071004
Change-Id: I5c724f0dc025dbfd06963373a8cb5fe7caf52803
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2275727
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
2020-07-01 00:30:49 +00:00
Patrick Brosset e65aaac861 Enable the no-return-assign ESLint rule
This rule disallows assigning a value in a return statement.
It also works in one-liner arrow functions.

For instance, a => a = 2 will trigger a warning.
This is to avoid cases where you actually meant to compare a to 2, not
assign the value 2 (maybe you wanted to return a boolean in a filter
callback).
These sorts of issues can easily pass review and cause weird problems
that are hard to track down later.

The rule is enabled in this CL, and all warnings are fixed with this CL.

More info about the rule: https://eslint.org/docs/rules/no-return-assign

Bug: 1093379
Change-Id: I38b98ea59ecaedc83a7f69073b17980808f9a3bf
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2242761
Reviewed-by: Patrick Brosset <patrick.brosset@microsoft.com>
Reviewed-by: Jose Leal <joselea@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Patrick Brosset <patrick.brosset@microsoft.com>
2020-06-22 08:34:42 +00:00
Christy Chen 3fa95bc487 [Loc] Update localization documentation
Add some FAQs for Loc V2.

Bug: 941561
Change-Id: I23ce46bc01d567f20764c7de8ccd5d7583e017b0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2238608
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Christy Chen <chrche@microsoft.com>
2020-06-12 00:16:15 +00:00
vidorteg afc030b08a Fixing console placeholder in properties panel (Elements tab)
$0 is used to reference the selected object in the console, but '$[0-9]+' is
also a special character in GRIT (used for localization), so they cannot
be mixed. The solution is to use a placeholder for $0 in the grds.

Change-Id: I8962261aab202016d6ab34fdea850329a9bf7888
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2175093
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Reviewed-by: Christy Chen <chrche@microsoft.com>
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
2020-05-26 17:00:56 +00:00
Alex Rudenko 7bf4d03c58 Move overlay implementation to DevTools
This CL moves the implementation of inspect_tool_highlight.html to
DevTools, sets up a separate resource build target containing code
bundles produced by rollup. Also, it adds size checks and sets up
an example test. The future CLs will cover the rest of inspector tools
and better tests. A follow-up CL for Chromium to use the newly generated
resource is prepared[1].

[1] https://crrev.com/c/2194865

Bug: 1078267
Change-Id: I1c66e3c2aaec04c2f07fab8623d674ada95d8b24
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2192892
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-05-14 06:05:14 +00:00
Jack Franklin c6577bae1c Add support for Platform.UIString calls in GRDP parsing
Now UIString is defined in Platform [1] we need to update the GRDP
parsing code to look for calls to it rather than `Common.UIString`.

We still support `Common.UIString` so this CL extends the script to look
for:

1) Usage outside of Platform:

```
import * as Platform from '../platform/platform.js';

Platform.UIString.UIString('foobarbaz');
```

2) Usage inside of Platform:
```
import {UIString} from './UIString.js';

UIString('foobarbaz');
```

[1]: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2165793

Change-Id: I8c0f97817709e936bdddce8f0b60d759e80fd1ba
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2170067
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
2020-04-28 14:13:33 +00:00
Tim van der Lippe bd52a5110c Use typescript-eslint parser for localizability pipeline
While clang-format and eslint support the modern javascript features,
the localizability pipeline did not. It was using esprima, which is
a parser that is not well maintained and does not support modern
features.

For our ESLint configuration, we are using the typescript-eslint
parser, which is compatible with espree, the parser powering ESLint.
Both espree and typescript-eslint have an API that is very similar
to esprima.

Therefore, update the localizability pipeline to use the espree API
with the concrete implementation of the API by typescript-eslint.

In the future, the localizability pipeline should probably be an
ESLint plugin so that we can unify the parsing experience.

A follow-up CL will remove all usages of esprima.

R=jacktfranklin@chromium.org

Fixed: 1068966
Change-Id: Idcffb8d649f006d7cf0b3de0ee0d886cb3848230
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2140939
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-04-08 13:52:11 +00:00
Mathias Bynens 88e8f15748 Enable no-case-declarations lint rule
Lexical declarations in `case` and `default` clauses are a footgun,
since they are visible in the entire switch block, but they only
get initialized upon assignment, which only happens if the relevant
`case` is actually reached.

To ensure that such lexical declarations only apply to the current
`case` (which is usually the intention), `case` clauses containing
them should be wrapped in curly braces to create an explicit block.

More information:
https://eslint.org/docs/rules/no-case-declarations

Change-Id: I63d9341fcd76d4b9ce8281bd0e6573b886577f08
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2119685
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-03-25 15:26:13 +00:00
Tim van der Lippe c2cb4301c9 Add missing license headers
In a follow-up CL we will be porting the license header check to ESLint.
This allows us to add missing license headers for TypeScript-authored
files. The script found some missing license headers already, which this
CL adds.

Change-Id: Id5041813281d2a7151297f9ed29baabc1cfd85af
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2097991
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-12 14:53:52 +00:00
Tim van der Lippe ba26b2b503 Run ESLint on the scripts directory
We weren't running ESLint on this directory and, as it turns out, there
are quite a few linter errors in this folder.

R=jacktfranklin@chromium.org

Change-Id: Ic6cb9f6ad4858f69114e0c433a954041215b49e2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2096705
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-03-11 14:47:51 +00:00
Jack Franklin 86d57122be Extend GRDP tooling with TypeScript support
This CL introduces support for parsing and pulling translations out of
`*.ts` files.

It introduces code to parse a TypeScript AST to look for `ls` calls and
pass them back into the existing GRDP tooling.

As a purposeful limitation, it _only looks for `ls` calls_.

Change-Id: I3f91793165e11f0382d6266f4e2c2443701b299a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2095295
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-10 11:50:43 +00:00
Jack Franklin 539b4d3bf5 Exclude front_end/third_party from GRDP file checks
No files in here are able to call our language funcs so there's no point
wasting effort checking them.

Change-Id: I006cb81a32a39fd099ea44869335dd81a8d3f734
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2094122
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-03-10 11:14:23 +00:00
vidorteg 80c894d4a1 Sanitizing check_localizable_resources description
Non-alphanumeric characters in the grdp description are interpreted as
part of the regular expression, this CL removes the description from
the matching process, as the ID is assumed to be unique.

Change-Id: I6463912e3b87e11f58ac6b2aa0e060353b12bd0d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2086431
Reviewed-by: Jack Lynch <jalyn@microsoft.com>
Reviewed-by: Jose Leal <joselea@microsoft.com>
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
2020-03-05 02:04:39 +00:00
Connor Clark 2bc3be29be Reland "[Lighthouse] Rename Audits panel to Lighthouse"
This reverts commit 0651468562.

Reason for revert: Cause of failure has been remedied. See: https://chromium-review.googlesource.com/c/chromium/src/+/2055398

Original change's description:
> Revert "[Lighthouse] Rename Audits panel to Lighthouse"
>
> This reverts commit 2ae53ef04d.
>
> Reason for revert: This CL breaks CI: https://ci.chromium.org/p/devtools-frontend/builders/ci/DevTools%20Linux/453. It looks like the layout test expects audits not lighthouse in the name, so it's probably in need of a 3-way merge.
>
> Original change's description:
> > [Lighthouse] Rename Audits panel to Lighthouse
> >
> > Change-Id: Ia2ab175d2a3b6c8ded73aff8ff0f5582f5a8fa0c
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2044605
> > Commit-Queue: Connor Clark <cjamcl@chromium.org>
> > Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> > Reviewed-by: Paul Irish <paulirish@chromium.org>
>
> TBR=paulirish@chromium.org,aerotwist@chromium.org,tvanderlippe@chromium.org,cjamcl@chromium.org
>
> Change-Id: Ia6d5f42a0e6ece4352696c51bf0de5754774cb0a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2051983
> Reviewed-by: Paul Lewis <aerotwist@chromium.org>
> Commit-Queue: Paul Lewis <aerotwist@chromium.org>

TBR=paulirish@chromium.org,aerotwist@chromium.org,tvanderlippe@chromium.org,cjamcl@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1052111
Change-Id: I638ca9bd5cd94e02fb7318f2a7d7c66fca40e6c8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2056866
Reviewed-by: Connor Clark <cjamcl@chromium.org>
Reviewed-by: Paul Irish <paulirish@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Connor Clark <cjamcl@chromium.org>
2020-02-18 01:56:25 +00:00
Paul Lewis 0651468562 Revert "[Lighthouse] Rename Audits panel to Lighthouse"
This reverts commit 2ae53ef04d.

Reason for revert: This CL breaks CI: https://ci.chromium.org/p/devtools-frontend/builders/ci/DevTools%20Linux/453. It looks like the layout test expects audits not lighthouse in the name, so it's probably in need of a 3-way merge.

Original change's description:
> [Lighthouse] Rename Audits panel to Lighthouse
> 
> Change-Id: Ia2ab175d2a3b6c8ded73aff8ff0f5582f5a8fa0c
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2044605
> Commit-Queue: Connor Clark <cjamcl@chromium.org>
> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
> Reviewed-by: Paul Irish <paulirish@chromium.org>

TBR=paulirish@chromium.org,aerotwist@chromium.org,tvanderlippe@chromium.org,cjamcl@chromium.org

Change-Id: Ia6d5f42a0e6ece4352696c51bf0de5754774cb0a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2051983
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-02-12 11:06:32 +00:00
Connor Clark 2ae53ef04d [Lighthouse] Rename Audits panel to Lighthouse
Change-Id: Ia2ab175d2a3b6c8ded73aff8ff0f5582f5a8fa0c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2044605
Commit-Queue: Connor Clark <cjamcl@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Irish <paulirish@chromium.org>
2020-02-11 22:43:22 +00:00
Christy Chen 1ab87e04c9 Fixed localization presubmit command line too long error
In presubmit.py, _CheckDevtoolsLocalization() gets all the paths of affected files and pass those in as arguments when running run_localization_check.py. When a lot of files need to be scanned, it casus the issue where character number exceed the limit of CreateProcess on Windows.

This PR changes the _CheckDevtoolsLocalization() to create a temp file that contains the affected file paths, and have the validation step read the affected file paths from the temp file.


Bug: 941561
Change-Id: I698e5064287eee8a8a3aca0682e3ab3521eb63d1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2032086
Reviewed-by: Lorne Mitchell <lomitch@microsoft.com>
Commit-Queue: Christy Chen <chrche@microsoft.com>
2020-01-31 23:01:04 +00:00
Tim van der Lippe 64a94d8105 Migrate object_ui/ to import cross-module
Bug: 1006759
Change-Id: Ic6a53e6183e3621771c019c4c9692c072f812736
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2019123
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-01-24 12:13:48 +00:00
Paul Lewis 25b001799e Adds known errors to include expanded namespace
Dupes the known errors for the Common.UIString.UIString namespace to
match the existing Common.UIString case.

Bug: 1006759
Change-Id: Ibf5a7ec632d43fca56d198b05a93ca6e79621388
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1985675
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-01-06 16:25:44 +00:00
Paul Lewis d0015fb415 Adds support for additional localization calls
As part of the ESM migration, certain function needs to be renamed over
to a different namespace, e.g. Common.UIString becomes
Common.UIString.UIString. As such the script that looks for instances of
Common.UIString for localization fails to identify instances of the
updated calls to Common.UIString.UIString. This CL updates
localization_utils so that it is aware of the updated namespaces, but
treats them in the same way as their legacy counterparts.

Bug: 1006759
Change-Id: I0a7da9109ee969da4caac3283c4ff26f4589f68a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1985674
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
2020-01-06 15:37:33 +00:00
Yang Guo 6e99c7c542 Move test and localization scripts
R=tvanderlippe@chromium.org

Change-Id: I9bfa77ef2791638b07089e4faf405f834ff47148
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1947525
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
2019-12-03 16:48:56 +00:00