diff --git a/front_end/components/BUILD.gn b/front_end/components/BUILD.gn
index 747f45a575..8fc22363c9 100644
--- a/front_end/components/BUILD.gn
+++ b/front_end/components/BUILD.gn
@@ -18,6 +18,7 @@ devtools_module("components") {
"../bindings:bundle",
"../common:bundle",
"../host:bundle",
+ "../i18n:bundle",
"../platform:bundle",
"../sdk:bundle",
"../text_utils:bundle",
diff --git a/front_end/components/ImagePreview.js b/front_end/components/ImagePreview.js
index 1b4df78bb5..2919e2296f 100644
--- a/front_end/components/ImagePreview.js
+++ b/front_end/components/ImagePreview.js
@@ -3,10 +3,38 @@
// found in the LICENSE file.
import * as Common from '../common/common.js';
+import * as i18n from '../i18n/i18n.js';
import * as Platform from '../platform/platform.js';
import * as SDK from '../sdk/sdk.js';
import * as UI from '../ui/ui.js';
+export const UIStrings = {
+ /**
+ *@description Description in Image Preview
+ *@example {500} PH1
+ *@example {300} PH2
+ *@example {200} PH3
+ *@example {100} PH4
+ */
+ sSPxIntrinsicSSPx: '{PH1} × {PH2} px (intrinsic: {PH3} × {PH4} px)',
+ /**
+ *@description Description in Image Preview
+ *@example {500} PH1
+ *@example {500} PH2
+ */
+ sSPx: '{PH1} × {PH2} px',
+ /**
+ *@description Alt text description of an image's source
+ */
+ unknownSource: 'unknown source',
+ /**
+ *@description Text to indicate the source of an image
+ *@example {example.com} PH1
+ */
+ imageFromS: 'Image from {PH1}',
+};
+const str_ = i18n.i18n.registerUIStrings('components/ImagePreview.js', UIStrings);
+const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
/** @typedef {{
* renderedWidth: number,
* renderedHeight: number,
@@ -74,10 +102,11 @@ export class ImagePreview {
let description;
if (showDimensions) {
if (renderedHeight !== intrinsicHeight || renderedWidth !== intrinsicWidth) {
- description =
- ls`${renderedWidth} × ${renderedHeight} px (intrinsic: ${intrinsicWidth} × ${intrinsicHeight} px)`;
+ description = i18nString(
+ UIStrings.sSPxIntrinsicSSPx,
+ {PH1: renderedWidth, PH2: renderedHeight, PH3: intrinsicWidth, PH4: intrinsicHeight});
} else {
- description = ls`${renderedWidth} × ${renderedHeight} px`;
+ description = i18nString(UIStrings.sSPx, {PH1: renderedWidth, PH2: renderedHeight});
}
}
@@ -127,7 +156,7 @@ export class ImagePreview {
*/
static defaultAltTextForImageURL(url) {
const parsedImageURL = new Common.ParsedURL.ParsedURL(url);
- const imageSourceText = parsedImageURL.isValid ? parsedImageURL.displayName : ls`unknown source`;
- return ls`Image from ${imageSourceText}`;
+ const imageSourceText = parsedImageURL.isValid ? parsedImageURL.displayName : i18nString(UIStrings.unknownSource);
+ return i18nString(UIStrings.imageFromS, {PH1: imageSourceText});
}
}
diff --git a/front_end/components/JSPresentationUtils.js b/front_end/components/JSPresentationUtils.js
index f3e935d853..443e15d9d3 100644
--- a/front_end/components/JSPresentationUtils.js
+++ b/front_end/components/JSPresentationUtils.js
@@ -30,11 +30,33 @@
*/
import * as Bindings from '../bindings/bindings.js';
+import * as i18n from '../i18n/i18n.js';
import * as SDK from '../sdk/sdk.js'; // eslint-disable-line no-unused-vars
import * as UI from '../ui/ui.js';
import {Linkifier} from './Linkifier.js';
+export const UIStrings = {
+ /**
+ *@description Text to stop preventing the debugger from stepping into library code
+ */
+ removeFromIgnore: 'Remove from ignore list',
+ /**
+ *@description Text for scripts that should not be stepped into when debugging
+ */
+ addToIgnore: 'Add script to ignore list',
+ /**
+ *@description Show all link text content in JSPresentation Utils
+ */
+ showMoreFrame: 'Show 1 more frame',
+ /**
+ *@description Show all link text content in JSPresentation Utils
+ *@example {2} PH1
+ */
+ showSMoreFrames: 'Show {PH1} more frames',
+};
+const str_ = i18n.i18n.registerUIStrings('components/JSPresentationUtils.js', UIStrings);
+const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
/**
* @param {?SDK.SDKModel.Target} target
* @param {!Linkifier} linkifier
@@ -105,11 +127,11 @@ export function buildStackTracePreviewContents(target, linkifier, options = {
Bindings.BlackboxManager.BlackboxManager.instance().canBlackboxUISourceCode(uiLocation.uiSourceCode)) {
if (Bindings.BlackboxManager.BlackboxManager.instance().isBlackboxedUISourceCode(uiLocation.uiSourceCode)) {
contextMenu.debugSection().appendItem(
- ls`Remove from ignore list`,
+ i18nString(UIStrings.removeFromIgnore),
() => Bindings.BlackboxManager.BlackboxManager.instance().unblackboxUISourceCode(uiLocation.uiSourceCode));
} else {
contextMenu.debugSection().appendItem(
- ls`Add script to ignore list`,
+ i18nString(UIStrings.addToIgnore),
() => Bindings.BlackboxManager.BlackboxManager.instance().blackboxUISourceCode(uiLocation.uiSourceCode));
}
}
@@ -148,9 +170,9 @@ export function buildStackTracePreviewContents(target, linkifier, options = {
cell.colSpan = 4;
const showAllLink = cell.createChild('span', 'link');
if (totalHiddenCallFramesCount === 1) {
- showAllLink.textContent = ls`Show 1 more frame`;
+ showAllLink.textContent = i18nString(UIStrings.showMoreFrame);
} else {
- showAllLink.textContent = ls`Show ${totalHiddenCallFramesCount} more frames`;
+ showAllLink.textContent = i18nString(UIStrings.showSMoreFrames, {PH1: totalHiddenCallFramesCount});
}
showAllLink.addEventListener('click', () => {
contentElement.classList.add('show-blackboxed');
diff --git a/front_end/components/Linkifier.js b/front_end/components/Linkifier.js
index 97220ae98b..df7f53a200 100644
--- a/front_end/components/Linkifier.js
+++ b/front_end/components/Linkifier.js
@@ -31,11 +31,42 @@
import * as Bindings from '../bindings/bindings.js';
import * as Common from '../common/common.js';
import * as Host from '../host/host.js';
+import * as i18n from '../i18n/i18n.js';
import * as SDK from '../sdk/sdk.js';
import * as TextUtils from '../text_utils/text_utils.js';
import * as UI from '../ui/ui.js';
import * as Workspace from '../workspace/workspace.js'; // eslint-disable-line no-unused-vars
+export const UIStrings = {
+ /**
+ *@description Text in Linkifier
+ */
+ unknown: '(unknown)',
+ /**
+ *@description Text short for automatic
+ */
+ auto: 'auto',
+ /**
+ *@description Text in Linkifier
+ *@example {Sources panel} PH1
+ */
+ revealInS: 'Reveal in {PH1}',
+ /**
+ *@description Text for revealing an item in its destination
+ */
+ reveal: 'Reveal',
+ /**
+ *@description A context menu item in the Linkifier
+ *@example {Extension} PH1
+ */
+ openUsingS: 'Open using {PH1}',
+ /**
+ *@description Text in Linkifier
+ */
+ linkHandling: 'Link handling:',
+};
+const str_ = i18n.i18n.registerUIStrings('components/Linkifier.js', UIStrings);
+const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
/** @type {!Set} */
const instances = new Set();
@@ -534,7 +565,7 @@ export class Linkifier {
if (className) {
element.className = className;
}
- element.textContent = text || url || Common.UIString.UIString('(unknown)');
+ element.textContent = text || url || i18nString(UIStrings.unknown);
return element;
}
@@ -777,7 +808,8 @@ export class Linkifier {
*/
static _linkHandlerSetting() {
if (!linkHandlerSettingInstance) {
- linkHandlerSettingInstance = Common.Settings.Settings.instance().createSetting('openLinkHandler', ls`auto`);
+ linkHandlerSettingInstance =
+ Common.Settings.Settings.instance().createSetting('openLinkHandler', i18nString(UIStrings.auto));
}
return linkHandlerSettingInstance;
}
@@ -840,7 +872,7 @@ export class Linkifier {
const destination = Common.Revealer.revealDestination(revealable);
result.push({
section: 'reveal',
- title: destination ? ls`Reveal in ${destination}` : ls`Reveal`,
+ title: destination ? i18nString(UIStrings.revealInS, {PH1: destination}) : i18nString(UIStrings.reveal),
handler: () => Common.Revealer.reveal(revealable)
});
}
@@ -853,7 +885,7 @@ export class Linkifier {
}
const action = {
section: 'reveal',
- title: Common.UIString.UIString('Open using %s', title),
+ title: i18nString(UIStrings.openUsingS, {PH1: title}),
handler: handler.bind(null, contentProvider, lineNumber)
};
if (title === Linkifier._linkHandlerSetting().get()) {
@@ -967,7 +999,7 @@ export class LinkHandlerSettingUI {
_update() {
this._element.removeChildren();
const names = [...linkHandlers.keys()];
- names.unshift(Common.UIString.UIString('auto'));
+ names.unshift(i18nString(UIStrings.auto));
for (const name of names) {
const option = document.createElement('option');
option.textContent = name;
@@ -993,7 +1025,7 @@ export class LinkHandlerSettingUI {
* @return {?Element}
*/
settingElement() {
- return UI.SettingsUI.createCustomSetting(Common.UIString.UIString('Link handling:'), this._element);
+ return UI.SettingsUI.createCustomSetting(i18nString(UIStrings.linkHandling), this._element);
}
}
@@ -1045,7 +1077,7 @@ export class ContentProviderContextMenuProvider {
continue;
}
contextMenu.revealSection().appendItem(
- Common.UIString.UIString('Open using %s', title), handler.bind(null, contentProvider, 0));
+ i18nString(UIStrings.openUsingS, {PH1: title}), handler.bind(null, contentProvider, 0));
}
if (contentProvider instanceof SDK.NetworkRequest.NetworkRequest) {
return;
diff --git a/front_end/components/TargetDetachedDialog.js b/front_end/components/TargetDetachedDialog.js
index f6660533e1..8841aee23d 100644
--- a/front_end/components/TargetDetachedDialog.js
+++ b/front_end/components/TargetDetachedDialog.js
@@ -2,9 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as i18n from '../i18n/i18n.js';
import * as SDK from '../sdk/sdk.js';
import * as UI from '../ui/ui.js';
+export const UIStrings = {
+ /**
+ *@description Text on the remote debugging window to indicate the connection is lost
+ */
+ websocketDisconnected: 'WebSocket disconnected',
+};
+const str_ = i18n.i18n.registerUIStrings('components/TargetDetachedDialog.js', UIStrings);
+const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
/**
* @implements {ProtocolProxyApi.InspectorDispatcher}
*/
@@ -28,7 +37,8 @@ export class TargetDetachedDialog extends SDK.SDKModel.SDKModel {
}
static webSocketConnectionLost() {
- UI.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(ls`WebSocket disconnected`);
+ UI.RemoteDebuggingTerminatedScreen.RemoteDebuggingTerminatedScreen.show(
+ i18nString(UIStrings.websocketDisconnected));
}
/**
diff --git a/front_end/components/components_strings.grdp b/front_end/components/components_strings.grdp
deleted file mode 100644
index f59d25dc3b..0000000000
--- a/front_end/components/components_strings.grdp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- (unknown)
-
-
- Reveal in $1sSources panel
-
-
- unknown source
-
-
- Show 1 more frame
-
-
- $1s500 × $2s300 px (intrinsic: $3s200 × $4s100 px)
-
-
- $1s500 × $2s500 px
-
-
- Show $1s2 more frames
-
-
- WebSocket disconnected
-
-
- Open using $1sExtension
-
-
- Link handling:
-
-
diff --git a/front_end/components/module.json b/front_end/components/module.json
index ecb74e1068..31258c8cd2 100644
--- a/front_end/components/module.json
+++ b/front_end/components/module.json
@@ -1,5 +1,6 @@
{
"dependencies": [
+ "i18n",
"bindings",
"platform",
"ui"
diff --git a/front_end/i18n/locales/en-US.json b/front_end/i18n/locales/en-US.json
index 784d807afb..5041e7156b 100644
--- a/front_end/i18n/locales/en-US.json
+++ b/front_end/i18n/locales/en-US.json
@@ -95,6 +95,51 @@
"changes/ModuleUIStrings.js | changesDrawer": {
"message": "Changes drawer"
},
+ "components/ImagePreview.js | imageFromS": {
+ "message": "Image from {PH1}"
+ },
+ "components/ImagePreview.js | sSPx": {
+ "message": "{PH1} × {PH2} px"
+ },
+ "components/ImagePreview.js | sSPxIntrinsicSSPx": {
+ "message": "{PH1} × {PH2} px (intrinsic: {PH3} × {PH4} px)"
+ },
+ "components/ImagePreview.js | unknownSource": {
+ "message": "unknown source"
+ },
+ "components/JSPresentationUtils.js | addToIgnore": {
+ "message": "Add script to ignore list"
+ },
+ "components/JSPresentationUtils.js | removeFromIgnore": {
+ "message": "Remove from ignore list"
+ },
+ "components/JSPresentationUtils.js | showMoreFrame": {
+ "message": "Show 1 more frame"
+ },
+ "components/JSPresentationUtils.js | showSMoreFrames": {
+ "message": "Show {PH1} more frames"
+ },
+ "components/Linkifier.js | auto": {
+ "message": "auto"
+ },
+ "components/Linkifier.js | linkHandling": {
+ "message": "Link handling:"
+ },
+ "components/Linkifier.js | openUsingS": {
+ "message": "Open using {PH1}"
+ },
+ "components/Linkifier.js | reveal": {
+ "message": "Reveal"
+ },
+ "components/Linkifier.js | revealInS": {
+ "message": "Reveal in {PH1}"
+ },
+ "components/Linkifier.js | unknown": {
+ "message": "(unknown)"
+ },
+ "components/TargetDetachedDialog.js | websocketDisconnected": {
+ "message": "WebSocket disconnected"
+ },
"cookie_table/CookiesTable.js | cookies": {
"message": "Cookies"
},
diff --git a/front_end/langpacks/devtools_ui_strings.grd b/front_end/langpacks/devtools_ui_strings.grd
index 7f71e2b487..0626350dde 100644
--- a/front_end/langpacks/devtools_ui_strings.grd
+++ b/front_end/langpacks/devtools_ui_strings.grd
@@ -17,7 +17,6 @@
-
diff --git a/front_end/langpacks/shared_strings.grdp b/front_end/langpacks/shared_strings.grdp
index 521850ec71..cf9759e6d0 100644
--- a/front_end/langpacks/shared_strings.grdp
+++ b/front_end/langpacks/shared_strings.grdp
@@ -106,9 +106,6 @@
checked
-
- Reveal
-
Screenshot
@@ -182,9 +179,6 @@
Pretty print
-
- Remove from ignore list
-
Open cubic bezier editor.
@@ -317,9 +311,6 @@
Save as...
-
- auto
-
(empty)
@@ -434,9 +425,6 @@
Close
-
- Add script to ignore list
-
Learn more
diff --git a/front_end/main/main_strings.grdp b/front_end/main/main_strings.grdp
index 874c679f6f..46eede8fb1 100644
--- a/front_end/main/main_strings.grdp
+++ b/front_end/main/main_strings.grdp
@@ -93,6 +93,9 @@
Drawer
+
+ auto
+
Dark
diff --git a/front_end/sources/sources_strings.grdp b/front_end/sources/sources_strings.grdp
index 3745e80e2c..c47c6ecc5f 100644
--- a/front_end/sources/sources_strings.grdp
+++ b/front_end/sources/sources_strings.grdp
@@ -225,6 +225,9 @@
Go to line
+
+ Remove from ignore list
+
Paused on XHR or fetch
@@ -534,6 +537,9 @@
Source map found, but ignored for file on ignore list.
+
+ Add script to ignore list
+
Add recording
diff --git a/front_end/timeline/timeline_strings.grdp b/front_end/timeline/timeline_strings.grdp
index b1128a4543..c44ef2a4aa 100644
--- a/front_end/timeline/timeline_strings.grdp
+++ b/front_end/timeline/timeline_strings.grdp
@@ -271,6 +271,9 @@ Click the reload button $3sreload or hit <
Run Microtasks
+
+ Reveal
+
Capture settings
diff --git a/scripts/localization/utils/check_localized_strings.js b/scripts/localization/utils/check_localized_strings.js
index 683cb653f8..002c84195d 100644
--- a/scripts/localization/utils/check_localized_strings.js
+++ b/scripts/localization/utils/check_localized_strings.js
@@ -109,6 +109,7 @@ let devtoolsFrontendDirs;
const migratedDirsSet = new Set([
'animation',
'changes',
+ 'components',
'cookie_table',
'coverage',
'developer_resources',