mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 09:47:56 +08:00
This PR adds devtools frontend localizability check to the presubmit script as reqeusted in https://chromium-review.googlesource.com/c/chromium/src/+/1504254. The new script, check_localizability.js, which run on frontend files changed as part of the devtools presubmit check. In addition, you can run $ npm run check-loc inside devtools/ to run the check on all frontend js files. **Note: Errors identified will be fixed and submitted as a separate PR. ** check_localizability.js usage: $ node check_localizability.js [-a | <.js file path>*] -a: scan all devtools frontend js files <.js file path>*: List of .js files with space-separated absolute paths Localizability violations that it scans for: - First argument to Common.UIString / UI.formatLocalized is not a string - Conditional argument (e.g. cond ? trueCase : falseCase) found in Common.UIString / UI.formatLocalized / ls tagged template literal - String concatenation is used with Common.UIString / UI.formatLocalized / ls`` - A specific argument to function is not localized (i.e. not wrapped in Common.UIString / UI.formatLocalized / ls``) - Currently, the script checks the third argument to createInput() Here are a few examples of errors the script can output: third_party\blink\renderer\devtools\front_end\resources\IndexedDBViews.js Line 1456: string concatenation should be changed to variable substitution with ls: ' (' + Common.UIString('Key path: ') third_party\blink\renderer\devtools\front_end\timeline\TimelineUIUtils.js Line 559-560: conditional(s) found in Common.UIString( '%s [%s\u2026%s]', url, event.args['beginData']['startLine'] + 1, endLine >= 0 ? endLine + 1 : ''). Please extract conditional(s) out of the localization call. Change-Id: I3243787ad5920b9b873f2feac7ed50a9c69bbe7e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1524993 Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Joel Einbinder <einbinder@chromium.org> Commit-Queue: Mandy Chen <mandy.chen@microsoft.com> Cr-Original-Commit-Position: refs/heads/master@{#643161} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: f1c8d4f5752ed8ab43babb602fa86121f8b14dbb
41 lines
1.5 KiB
JSON
41 lines
1.5 KiB
JSON
{
|
|
"name": "chrome-devtools-frontend",
|
|
"description": "Chrome DevTools UI",
|
|
"scripts": {
|
|
"start": "node scripts/start_chrome_and_server.js",
|
|
"chrome": "node scripts/chrome_debug_launcher/launch_chrome.js",
|
|
"server": "node scripts/hosted_mode/server.js",
|
|
"test": "node scripts/npm_test.js",
|
|
"debug-test": "node scripts/npm_test.js --debug-devtools",
|
|
"lint": "eslint front_end",
|
|
"closure": "python scripts/compile_frontend.py",
|
|
"setup-dtrun": "cd scripts/devtools_run && npm link",
|
|
"format-py": "yapf --exclude scripts/build/rjsmin.py -i --recursive scripts PRESUBMIT.py",
|
|
"extract": "node scripts/extract_module/extract_module.js",
|
|
"check-gn": "node scripts/check_gn.js",
|
|
"check-json": "node scripts/json_validator/validate_module_json.js",
|
|
"check-loc": "node scripts/check_localizability.js -a",
|
|
"generate-jsconfig": "node scripts/generate_jsconfig.js"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/ChromeDevTools/devtools-frontend.git"
|
|
},
|
|
"keywords": [
|
|
"devtools",
|
|
"chrome",
|
|
"chromium",
|
|
"blink",
|
|
"debugger"
|
|
],
|
|
"author": "The Chromium Authors",
|
|
"license": "SEE LICENSE IN https://chromium.googlesource.com/chromium/src/+/master/LICENSE",
|
|
"bugs": {
|
|
"url": "https://bugs.chromium.org/p/chromium/issues/list?can=2&q=component:Platform%3EDevTools%20&sort=-opened&colspec=ID%20Stars%20Owner%20Summary%20Modified%20Opened"
|
|
},
|
|
"homepage": "https://devtools.chrome.com",
|
|
"devDependencies": {
|
|
"ajv": "^5.1.5"
|
|
}
|
|
}
|