From bbdf7342fee4e6ff7425b6646475fa586bbc8e2d Mon Sep 17 00:00:00 2001 From: Christy Chen Date: Mon, 7 Dec 2020 15:57:42 -0800 Subject: [PATCH] Make collect-strings work with .ts files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current collect-strings only scan .js file extension. This CL enables string collecting in .ts files. Bug: 1136655 Change-Id: Ia6b4aa364496a80288edad49a471017923f71f05 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2575514 Reviewed-by: Simon Zünd Reviewed-by: Peter Marshall Reviewed-by: Patrick Brosset Reviewed-by: Vidal Diazleal Commit-Queue: Christy Chen --- third_party/i18n/README.chromium | 1 + third_party/i18n/collect-strings.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/i18n/README.chromium b/third_party/i18n/README.chromium index f2ef4d0c99..c8a4506124 100644 --- a/third_party/i18n/README.chromium +++ b/third_party/i18n/README.chromium @@ -16,3 +16,4 @@ Local Modifications: 4. Remove pruneObsoleteLhlMessages() and check collisions step 5. Implement getToken() to avoid requiring the exportVars (liveUIStrings) due to ESM limitation in collectAllStringsInDir() 6. Remove backtick for locked term after converting it to placeholder in ctc.json +7. Enable the scanning of files with .ts extensions diff --git a/third_party/i18n/collect-strings.js b/third_party/i18n/collect-strings.js index 2a89c2d7bc..020deb1a07 100644 --- a/third_party/i18n/collect-strings.js +++ b/third_party/i18n/collect-strings.js @@ -561,7 +561,7 @@ function collectAllStringsInDir(dir) { /** @type {Record} */ const strings = {}; - const globPattern = path.join(path.relative(SRC_ROOT, dir), '/**/*.js'); + const globPattern = path.join(path.relative(SRC_ROOT, dir), '/**/*.{js,ts}'); const files = glob.sync(globPattern, { cwd: SRC_ROOT, ignore: ignoredPathComponents,