Commit Graph
46 Commits
Author SHA1 Message Date
Christy Chen 87d9ffc323 [Loc] Migrate input to Localization V2
Bug: 1136655
Change-Id: I7d8b1c34aaea07b896ec913faf141381422c3bd6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2580848
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-12-09 17:59:07 +00:00
Christy Chen 19739b881b [Loc] Migrate help to localization V2
migrate help directory

Bug: 1136655
Change-Id: Ib361747d53faa0a5cc860d331238e08d327031cc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2577943
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-12-08 21:25:02 +00:00
Christy Chen cebafe7ed6 [Loc] Migrate workspace to localization V2
Bug: 1136655
Change-Id: Ia6a4ff1c043f1b02656a9d7edf640f04f2f1e9a1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2577936
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-12-08 20:19:22 +00:00
Christy Chen b97d85b7ca [Loc] Migrate protocol monitor tool to localization V2
Migrate protocol monitor tool
Tested with en-XL: https://imgur.com/a/IPT8ly2


Bug: 1136655
Change-Id: I538590b76e8511cc539d3b4770790db34c2ec5f9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2572872
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-12-04 22:22:17 +00:00
vidorteg d083f4ab10 [Loc] Migrate media panel to Localization V2
- Migrate media panel to use Localization V2 APIs.
- Removed media grdps

Tested with en-XL.json
https://imgur.com/a/j3MxnLu

Bug: 1136655
Change-Id: Iebcce7e991db19cda8477f75b180390e1e7f5a78
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2570496
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
2020-12-03 17:28:01 +00:00
Christy Chen 5d7848d54d Reland "[Loc] Migrate changes tool to localization V2"
This reverts commit 9e5ab71e50.

Reason for revert: The Cl was reverted due to devtools pak file limitation. That issue has been fixed in https://chromium-review.googlesource.com/c/chromium/src/+/2558341

Original change's description:
> Revert "[Loc] Migrate changes tool to localization V2"
>
> This reverts commit abcb8f7aa8.
>
> Reason for revert: Consistently causing autoroll issues when rolling devtools-frontend into Chromium - see https://chromium-review.googlesource.com/c/chromium/src/+/2554521 for an example.
>
> To recreate this, do a debug build of Chromium with this patch applied to DevTools. It's causing an issue with duplicate keys in the pak files. No DevTools Frontend builds do a debug build of Chromium with the DevTools frontend patch applied so our CQ will be green despite causing an issue.
>
> You can run this locally in Chromium to reproduce via:
>
> autoninja -C out/Default chrome:packed_resources_extra
>
> Which will show the error. 
>
> Original change's description:
> > [Loc] Migrate changes tool to localization V2
> >
> > Migrate changes tool
> > Tested with en-XL: https://imgur.com/a/hFDBjQV
> >
> >
> > Bug: 1136655
> > Change-Id: Ic434c3085b9e2f2cf44583cca7ee1ce8f1d412f2
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2548688
> > Commit-Queue: Christy Chen <chrche@microsoft.com>
> > Reviewed-by: Simon Zünd <szuend@chromium.org>
>
> TBR=szuend@chromium.org,chrche@microsoft.com
>
> Change-Id: I94b27434562f6a6bff3be381ab8a5802bd8b03f9
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 1136655
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2557044
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>

TBR=szuend@chromium.org,chrche@microsoft.com,jacktfranklin@chromium.org

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

Bug: 1136655
Change-Id: I35166a6f4f38462073b933c01c169b3c8d14311b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2567344
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Christy Chen <chrche@microsoft.com>
Commit-Queue: Christy Chen <chrche@microsoft.com>
2020-12-02 06:13:17 +00:00
Kalon Hinds de5da1203d [Loc] Migrate snippets to Localization V2
Bug: 1136655
Change-Id: I724747d248b047ce85761b9ec7c6ae512c939ddb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2548691
Commit-Queue: Kalon Hinds <kahinds@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-12-01 21:54:27 +00:00
Kalon Hinds 1f437b9488 [Loc] Migrate performance_monitor to Localization V2
Bug: 1136655
Change-Id: I281da13c70cc56a92679064d122873b406d54377
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2553935
Commit-Queue: Kalon Hinds <kahinds@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-25 08:31:14 +00:00
Jack Franklin 9e5ab71e50 Revert "[Loc] Migrate changes tool to localization V2"
This reverts commit abcb8f7aa8.

Reason for revert: Consistently causing autoroll issues when rolling devtools-frontend into Chromium - see https://chromium-review.googlesource.com/c/chromium/src/+/2554521 for an example.

To recreate this, do a debug build of Chromium with this patch applied to DevTools. It's causing an issue with duplicate keys in the pak files. No DevTools Frontend builds do a debug build of Chromium with the DevTools frontend patch applied so our CQ will be green despite causing an issue.

You can run this locally in Chromium to reproduce via:

autoninja -C out/Default chrome:packed_resources_extra

Which will show the error. 

Original change's description:
> [Loc] Migrate changes tool to localization V2
>
> Migrate changes tool
> Tested with en-XL: https://imgur.com/a/hFDBjQV
>
>
> Bug: 1136655
> Change-Id: Ic434c3085b9e2f2cf44583cca7ee1ce8f1d412f2
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2548688
> Commit-Queue: Christy Chen <chrche@microsoft.com>
> Reviewed-by: Simon Zünd <szuend@chromium.org>

TBR=szuend@chromium.org,chrche@microsoft.com

Change-Id: I94b27434562f6a6bff3be381ab8a5802bd8b03f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1136655
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2557044
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2020-11-24 10:54:09 +00:00
Christy Chen abcb8f7aa8 [Loc] Migrate changes tool to localization V2
Migrate changes tool
Tested with en-XL: https://imgur.com/a/hFDBjQV


Bug: 1136655
Change-Id: Ic434c3085b9e2f2cf44583cca7ee1ce8f1d412f2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2548688
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-11-23 18:46:16 +00:00
vidorteg 068400262b [Loc] Migrate lighthouse panel to Localization V2
- Migrate lighthouse panel to use Localization V2 APIs.
- Does not migrate lighthouse-worker yet (which builds the report)
- Removed lighthouse grdps

Tested with en-XL.json
https://imgur.com/a/sjbn3C5

Bug: 1136655
Change-Id: Ib55fabf941e4c0ae7ef5e1beb3cf4726b836386e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2548696
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-11-21 05:39:03 +00:00
vidorteg af634bcc6c [Loc] Migrate animation panel to Localization V2
- Migrate animation panel to use Localization V2 APIs.
- Removed animation grdps

Tested with en-XL.json
https://imgur.com/a/eVERZjZ

Bug: 1136655
Change-Id: I71fdcff68757b13ed72d735644ef09c6609f54d3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2548263
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-11-21 02:28:13 +00:00
Kalon Hinds 361d02972a [Loc] Migrate developer_resources to Localization V2
Bug: 1136655
Change-Id: I01278b1c215dd7efa7255223a520df3524c53897
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2552105
Commit-Queue: Kalon Hinds <kahinds@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-20 19:47:24 +00:00
Christy Chen d0b25f6e31 [Loc] Migrate search to localization V2
Migrate search tool
Tested with en-XL: https://imgur.com/a/3Nv2hWE


Bug: 1136655
Change-Id: Icd29a61f4bc7df220a03f3d17c2a2f79c0ba0572
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2548220
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Kalon Hinds <kahinds@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-19 19:21:46 +00:00
Christy Chen 0a48864e1e [Loc] Migrate text_editor to localization V2
Migrate text_editor folder


Bug: 1136655
Change-Id: Ib67eb334eaf4cf25cc07b077ce6aa7c9b29e77f5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2548275
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-19 18:13:13 +00:00
Kalon Hinds 438d44197a [Loc] Migrate security to Localization V2
Bug: 1136655
Change-Id: I77e776f00249eb97f49e24681d19722f500c4c86
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2546327
Commit-Queue: Kalon Hinds <kahinds@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-19 01:34:11 +00:00
vidorteg 5c2ea4d80c [Loc] Migrate layer_viewer to Loc V2
- Migrate layer_viewer panel to use Localization V2 APIs.
- Removed layer_viewer grdps

Tested with en-XL.json
https://imgur.com/a/nYe4KRL

Bug: 1136655
Change-Id: Iebcb0c125a73b6eab6a24ff91f2a39440155e768
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2546322
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-18 20:04:22 +00:00
vidorteg 0527ac564a [Loc] Migrate layers to Loc V2
- Migrate layers panel to use Localization V2 APIs.
- Removed layers grdps

Tested with en-XL.json
https://imgur.com/a/13R1mXF

Bug: 1136655
Change-Id: I255b1edbc265aab11728f78905c55d77a5fb3bb9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2543113
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-17 20:02:06 +00:00
Christy Chen 14a913c836 [Loc] Migrate webauthn to localization V2
Migrate webAuthn tool
Tested with en-XL: https://imgur.com/a/medKsEq


Bug: 1136655
Change-Id: Id44fc298fb38f09467eedb77a3a2d50493462ac1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2543102
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-17 19:02:27 +00:00
Christy Chen 598b98fe2b [Loc] Migrate web_audio to localization V2
Migrate web_audio tool
Tested with en-XL: https://imgur.com/0eEBFqM

Bug: 1136655
Change-Id: Ibef905a1302eb807de78296bccaadc1559d5f642
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2538490
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-16 19:32:49 +00:00
Christy Chen ea635f12e8 [Loc] Migrate devices directory
Migrate Remote Devices tool (devices directory)

(Note: this is a deprecated panel, and it's currently blank, so couldnt test with en-XL)

Bug: 1136655
Change-Id: I8e24de06c295ef8886b788dcacea106be0cb33ca
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2521685
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-11-11 23:52:09 +00:00
Christy Chen 2e411e2f84 [Loc] Migrate coverage to Loc V2
- Migrate coverage panel to use LocV2 apis.
- Removed unused grdps

Tested with en-XL.json
https://imgur.com/a/61yoUNo

Bug: 1136655
Change-Id: Ie5de60d4e62a1496f9642d8eeed0e326727f17d3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2504408
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
2020-11-03 17:06:17 +00:00
vidorteg c1aeb6318c Reland "Localization: Migrating Settings Folder"
Relanding the migration of the settings folder that was reverted in here:
2479923: Revert "Localization: Migrating Settings Folder" | https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2479923

Also including this fix that is required but was also reverted here:
2476336: Fix missing settings/ModuleUIStrings.js in build config | https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2476336

Change-Id: Ie2335e8943e8be3f8363a45d14c93f3b695222e4
Bug: 1136655
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2481510
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Christy Chen <chrche@microsoft.com>
2020-10-22 16:18:20 +00:00
vidorteg 6d2775c5ef Modifying scripts for i18nString localization call
Modifying some scripts that verify the shape of localization calls
to work with the i18nString shorthand:

const i18nString = i18.i18n.getLocalizedString.bind(undefined, str_);

Bug: 1136655
Change-Id: I09a961136dd89e8af11ab33f413f315e61184078
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2469903
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Christy Chen <chrche@microsoft.com>
2020-10-14 21:12:22 +00:00
Christy Chen 5a23b94362 Fixing two localization presubmit issues
1. Don't generate grdp strings if they are in ModuleUIString.js
2. Use path.basename instead of index slicing when getting the directory name for a filepath

Bug: 1136655
Change-Id: I828461a4be2dbeaecd4db76eeb13fce53871d16f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2461794
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Christy Chen <chrche@microsoft.com>
2020-10-09 17:20:24 +00:00
vidorteg ca8fc9b475 Removing check_localizability.js verification
The current behavior enforces that the second argument passed to all
i18n.getLocalizedString is part of UIStrings structure, this is not
possible to enforce in the current shape as a reference is also a valid
scenario

--------  e.g-----------

const title1 = UIStrings.title1;
const title2 = UIStrings.title2;

function render(title) { i18n.getLocalizedString(str, title) }

--------  end e.g-----------

Also minor fix in the naming convention of the file (localizationV2checks)

Change-Id: I9e7536850f7bbb73b2e27f5906343b3b1dbfd82d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2451369
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Christy Chen <chrche@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
2020-10-07 16:46:15 +00:00
Christy Chen 0786ad2f56 [Loc] Avoid unnecessary escodegen calls in presubmit
Only call escodegen.generate() on the nodes that are necessary, or it would impact the performance of presubmit

Bug: 1116989
Change-Id: Ic80c7498aee14b7a4bf6462c26c982b7d6170f39
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2405627
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-09-11 08:23:36 +00:00
Christy Chen 5fc363ed10 [Loc] Presubmit#3: LocV2 Checking the shape of localization API calls
Checking the shape of localization API calls:
if the node is Common.i18n.getLocalizedString,
1. There should be at least two arguments
2. The first argument should be the string instance function 'str_',
3. The second argument should reference the UIStrings object like 'UIStrings.url'

The code would look like:
i18n.i18n.getLocalizedString(str_, UIStrings.url);

Bug: 941561
Change-Id: I1336867b06dd727f5164e6b1d7ac7ae6ed6ea446
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2245769
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-09-09 16:40:02 +00:00
Christy Chen 138c3a87b6 [Loc] Presubmit#2: prevent using of LocV1 APIs in migrated files
The check will prevent the using of V1 APIs in the files under the directory that we determine as 'migrated', or when UIStrings is declared in a file.
Two way to test
1. add to any .js file that calls ls``
export const UIStrings = {
  /**
  *@description a fake string
  */
  fakeString: 'a fakeString',
};

or

in check_localized_strings.js
Update `const migratedDirsSet = new Set([]);`
To `const migratedDirsSet = new Set(['settings', 'console']);`

2. run check_localizable_resources.js

The check will complain about some some files have APIs need to be migrated

See Loc design doc #Presubmit section for details
https://docs.google.com/document/d/1L6TkT2-42MMQ72ZSBMFwUaq7M6mDgA2X0x8oHHKaV_U/edit#heading=h.w1no7qaa0mi0


Bug: 941561
Change-Id: I4f8fba41ac1dd393fdb399d7e580e9a9ba39143a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2244052
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2020-09-09 15:55:23 +00:00
Christy Chen 6c5e5870e0 [Loc] Presubmit#1: Check unused resources in UIStrings
This check will detect (and autofix) any string resources that are not used in the code anymore. If a developer deletes a localization call but forgets to delete it from the UIStrings structure, the check will warn/remove it.

Testing steps
1. Add the following to the CoverageView.js right after import statements
export const UIStrings = {
  /**
  *@description Text in Coverage List View of the Coverage tab
  */
  perFunction: 'Per function',
  /**
  *@description Text in Coverage List View of the Coverage tab
  */
  perBlock: 'Per block',
};

2. Change: 
        label: ls`Per function`,
 To the Loc V2 API call:
        label: i18n.i18n.getLocalizedString(str_, UIStrings.perFunction),

3. Change:
        label: ls`Per block`,
 To not use any localization API
        label: "Per block",

4. Run
node check_localizable_resources.js --autofix

The Loc V1 check would remove the two entries from grdp
The Loc V2 check would remove perBlock entry from UIStrings

See Loc design doc #Presubmit section for details
https://docs.google.com/document/d/1L6TkT2-42MMQ72ZSBMFwUaq7M6mDgA2X0x8oHHKaV_U/edit#heading=h.w1no7qaa0mi0




Bug: 941561
Change-Id: Ic5f3ee6e9c1586bb3226593c32bc7af7e49a547a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2236544
Commit-Queue: Christy Chen <chrche@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2020-09-09 08:07:29 +00:00
Paul Lewis 0cf22e5ad8 [loc] Escape paths correctly
The localization_utils check a list of excluded directories against the
subdirectories of front_end. However, the list of directories hardcoded
the / separator, which is incorrect on Windows. This led to localization
checks in third_party subdirectories, causing build breakages and
performance regressions. This CL updates the paths to use the node
path.sep value, which in turn means that the string matching works on all\
platforms.

R=tvanderlippe@chromium.org

Change-Id: I5e1f2400b3f331ff4ac7acf953042b2ad900d40b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2398827
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-09-08 16:42:39 +00:00
Christy Chen 23909d8cfc [Loc] Presubmit performance improvement
The current Loc presubmit are doing two checks: check_localizable_resources and check_localizability
(Details of what they are checking: https://docs.google.com/document/d/1L6TkT2-42MMQ72ZSBMFwUaq7M6mDgA2X0x8oHHKaV_U/edit#heading=h.w1no7qaa0mi0)

This CL merge two checks into one single check. check_localizability are modified into a utils file, and check_localizable_resources will also run those localizability checks when the files are visited. By doing this, we avoid the extra call to node during presubmit, and all files and nodes will only be visited once.

Also adding these fixes
https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2370103
Fix:
- Pass the fullpath for comparison.(itemPath)
- Normalize comparison between paths
- using native fs.promises instead of promisify (https://github.com/nodejs/node/pull/26581)

Bug: 1116989
Change-Id: I054040d83a65b5f798a21c040096422e287bc799
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2381320
Reviewed-by: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Christy Chen <chrche@microsoft.com>
2020-09-04 05:07:07 +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
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 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
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
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 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