diff --git a/all_devtools_modules.gni b/all_devtools_modules.gni index 70efd218e5..d7687831c7 100644 --- a/all_devtools_modules.gni +++ b/all_devtools_modules.gni @@ -43,6 +43,7 @@ all_typescript_module_sources = [ "browser_debugger/CategorizedBreakpointsSidebarPane.js", "browser_debugger/DOMBreakpointsSidebarPane.js", "browser_debugger/EventListenerBreakpointsSidebarPane.js", + "browser_debugger/ModuleUIStrings.js", "browser_debugger/ObjectEventListenersSidebarPane.js", "browser_debugger/XHRBreakpointsSidebarPane.js", "browser_sdk/IssuesManager.js", diff --git a/devtools_grd_files.gni b/devtools_grd_files.gni index f720d6ee36..1e8438388a 100644 --- a/devtools_grd_files.gni +++ b/devtools_grd_files.gni @@ -470,6 +470,7 @@ grd_files_debug_sources = [ "front_end/browser_debugger/CategorizedBreakpointsSidebarPane.js", "front_end/browser_debugger/DOMBreakpointsSidebarPane.js", "front_end/browser_debugger/EventListenerBreakpointsSidebarPane.js", + "front_end/browser_debugger/ModuleUIStrings.js", "front_end/browser_debugger/ObjectEventListenersSidebarPane.js", "front_end/browser_debugger/XHRBreakpointsSidebarPane.js", "front_end/browser_sdk/IssuesManager.js", diff --git a/front_end/browser_debugger/BUILD.gn b/front_end/browser_debugger/BUILD.gn index 677243b7cf..e37e50dc52 100644 --- a/front_end/browser_debugger/BUILD.gn +++ b/front_end/browser_debugger/BUILD.gn @@ -11,6 +11,7 @@ devtools_module("browser_debugger") { "CategorizedBreakpointsSidebarPane.js", "DOMBreakpointsSidebarPane.js", "EventListenerBreakpointsSidebarPane.js", + "ModuleUIStrings.js", "ObjectEventListenersSidebarPane.js", "XHRBreakpointsSidebarPane.js", ] @@ -18,6 +19,7 @@ devtools_module("browser_debugger") { deps = [ "../common:bundle", "../event_listeners:bundle", + "../i18n:bundle", "../sdk:bundle", "../sources:bundle", "../ui:bundle", diff --git a/front_end/browser_debugger/CategorizedBreakpointsSidebarPane.js b/front_end/browser_debugger/CategorizedBreakpointsSidebarPane.js index 6095325d1f..05347ec966 100644 --- a/front_end/browser_debugger/CategorizedBreakpointsSidebarPane.js +++ b/front_end/browser_debugger/CategorizedBreakpointsSidebarPane.js @@ -2,10 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {ls} from '../platform/platform.js'; +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 Screen reader description of a hit breakpoint in the Sources panel + */ + breakpointHit: 'breakpoint hit', +}; +const str_ = i18n.i18n.registerUIStrings('browser_debugger/CategorizedBreakpointsSidebarPane.js', UIStrings); +const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); /** * @abstract */ @@ -149,7 +157,7 @@ export class CategorizedBreakpointsSidebarPane extends UI.Widget.VBox { const matchingBreakpoint = this._breakpoints.get(breakpoint); if (matchingBreakpoint) { this._highlightedElement = matchingBreakpoint.element.listItemElement; - UI.ARIAUtils.setDescription(this._highlightedElement, ls`breakpoint hit`); + UI.ARIAUtils.setDescription(this._highlightedElement, i18nString(UIStrings.breakpointHit)); this._highlightedElement.classList.add('breakpoint-hit'); } } diff --git a/front_end/browser_debugger/DOMBreakpointsSidebarPane.js b/front_end/browser_debugger/DOMBreakpointsSidebarPane.js index 13a1d682a3..d746ed0581 100644 --- a/front_end/browser_debugger/DOMBreakpointsSidebarPane.js +++ b/front_end/browser_debugger/DOMBreakpointsSidebarPane.js @@ -29,11 +29,74 @@ */ import * as Common from '../common/common.js'; -import {ls} from '../platform/platform.js'; +import * as i18n from '../i18n/i18n.js'; import * as SDK from '../sdk/sdk.js'; import * as Sources from '../sources/sources.js'; import * as UI from '../ui/ui.js'; +export const UIStrings = { + /** + *@description Text to indicate there are no breakpoints + */ + noBreakpoints: 'No breakpoints', + /** + *@description Accessibility label for the DOM breakpoints list in the Sources panel + */ + domBreakpointsList: 'DOM Breakpoints list', + /** + *@description Text with two placeholders separated by a colon + *@example {Node removed} PH1 + *@example {div#id1} PH2 + */ + sS: '{PH1}: {PH2}', + /** + *@description Text exposed to screen readers on checked items. + */ + checked: 'checked', + /** + *@description Text exposed to screen readers on unchecked items. + */ + unchecked: 'unchecked', + /** + *@description Accessibility label for hit breakpoints in the Sources panel. + *@example {checked} PH1 + */ + sBreakpointHit: '{PH1} breakpoint hit', + /** + *@description Screen reader description of a hit breakpoint in the Sources panel + */ + breakpointHit: 'breakpoint hit', + /** + *@description A context menu item in the DOM Breakpoints sidebar that reveals the node on which the current breakpoint is set. + */ + revealDomNodeInElementsPanel: 'Reveal DOM node in Elements panel', + /** + *@description Text to remove a breakpoint + */ + removeBreakpoint: 'Remove breakpoint', + /** + *@description A context menu item in the DOMBreakpoints Sidebar Pane of the JavaScript Debugging pane in the Sources panel or the DOM Breakpoints pane in the Elements panel + */ + removeAllDomBreakpoints: 'Remove all DOM breakpoints', + /** + *@description Text in DOMBreakpoints Sidebar Pane of the JavaScript Debugging pane in the Sources panel or the DOM Breakpoints pane in the Elements panel + */ + subtreeModified: 'Subtree modified', + /** + *@description Text in DOMBreakpoints Sidebar Pane of the JavaScript Debugging pane in the Sources panel or the DOM Breakpoints pane in the Elements panel + */ + attributeModified: 'Attribute modified', + /** + *@description Text in DOMBreakpoints Sidebar Pane of the JavaScript Debugging pane in the Sources panel or the DOM Breakpoints pane in the Elements panel + */ + nodeRemoved: 'Node removed', + /** + *@description A context menu item in the DOMBreakpoints Sidebar Pane of the JavaScript Debugging pane in the Sources panel or the DOM Breakpoints pane in the Elements panel + */ + breakOn: 'Break on', +}; +const str_ = i18n.i18n.registerUIStrings('browser_debugger/DOMBreakpointsSidebarPane.js', UIStrings); +const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); /** @type {!DOMBreakpointsSidebarPane} */ let domBreakpointsSidebarPaneInstance; @@ -53,7 +116,7 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox { this.elementToCheckboxes = new WeakMap(); this._emptyElement = this.contentElement.createChild('div', 'gray-info-message'); - this._emptyElement.textContent = Common.UIString.UIString('No breakpoints'); + this._emptyElement.textContent = i18nString(UIStrings.noBreakpoints); /** @type {!UI.ListModel.ListModel.} */ this._breakpoints = new UI.ListModel.ListModel(); /** @type {!UI.ListControl.ListControl.} */ @@ -61,7 +124,7 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox { this.contentElement.appendChild(this._list.element); this._list.element.classList.add('breakpoint-list', 'hidden'); UI.ARIAUtils.markAsList(this._list.element); - UI.ARIAUtils.setAccessibleName(this._list.element, ls`DOM Breakpoints list`); + UI.ARIAUtils.setAccessibleName(this._list.element, i18nString(UIStrings.domBreakpointsList)); this._emptyElement.tabIndex = -1; SDK.SDKModel.TargetManager.instance().addModelListener( @@ -124,22 +187,23 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox { const description = document.createElement('div'); const breakpointTypeLabel = BreakpointTypeLabels.get(item.type); description.textContent = breakpointTypeLabel || null; - UI.ARIAUtils.setAccessibleName(checkboxElement, ls`${breakpointTypeLabel}`); + UI.ARIAUtils.setAccessibleName(checkboxElement, breakpointTypeLabel || ''); const linkifiedNode = document.createElement('monospace'); linkifiedNode.style.display = 'block'; labelElement.appendChild(linkifiedNode); Common.Linkifier.Linkifier.linkify(item.node, {preventKeyboardFocus: true, tooltip: undefined}).then(linkified => { linkifiedNode.appendChild(linkified); - UI.ARIAUtils.setAccessibleName(checkboxElement, ls`${breakpointTypeLabel}: ${linkified.deepTextContent()}`); + UI.ARIAUtils.setAccessibleName( + checkboxElement, i18nString(UIStrings.sS, {PH1: breakpointTypeLabel, PH2: linkified.deepTextContent()})); }); labelElement.appendChild(description); - const checkedStateText = item.enabled ? ls`checked` : ls`unchecked`; + const checkedStateText = item.enabled ? i18nString(UIStrings.checked) : i18nString(UIStrings.unchecked); if (item === this._highlightedBreakpoint) { element.classList.add('breakpoint-hit'); - UI.ARIAUtils.setDescription(element, ls`${checkedStateText} breakpoint hit`); - UI.ARIAUtils.setDescription(checkboxElement, ls`breakpoint hit`); + UI.ARIAUtils.setDescription(element, i18nString(UIStrings.sBreakpointHit, {PH1: checkedStateText})); + UI.ARIAUtils.setDescription(checkboxElement, i18nString(UIStrings.breakpointHit)); } else { UI.ARIAUtils.setDescription(element, checkedStateText); } @@ -273,11 +337,11 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox { _contextMenu(breakpoint, event) { const contextMenu = new UI.ContextMenu.ContextMenu(event); contextMenu.defaultSection().appendItem( - ls`Reveal DOM node in Elements panel`, () => Common.Revealer.reveal(breakpoint.node)); - contextMenu.defaultSection().appendItem(Common.UIString.UIString('Remove breakpoint'), () => { + i18nString(UIStrings.revealDomNodeInElementsPanel), () => Common.Revealer.reveal(breakpoint.node)); + contextMenu.defaultSection().appendItem(i18nString(UIStrings.removeBreakpoint), () => { breakpoint.domDebuggerModel.removeDOMBreakpoint(breakpoint.node, breakpoint.type); }); - contextMenu.defaultSection().appendItem(Common.UIString.UIString('Remove all DOM breakpoints'), () => { + contextMenu.defaultSection().appendItem(i18nString(UIStrings.removeAllDomBreakpoints), () => { breakpoint.domDebuggerModel.removeAllDOMBreakpoints(); }); contextMenu.show(); @@ -333,9 +397,9 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox { } export const BreakpointTypeLabels = new Map([ - [Protocol.DOMDebugger.DOMBreakpointType.SubtreeModified, Common.UIString.UIString('Subtree modified')], - [Protocol.DOMDebugger.DOMBreakpointType.AttributeModified, Common.UIString.UIString('Attribute modified')], - [Protocol.DOMDebugger.DOMBreakpointType.NodeRemoved, Common.UIString.UIString('Node removed')], + [Protocol.DOMDebugger.DOMBreakpointType.SubtreeModified, i18nString(UIStrings.subtreeModified)], + [Protocol.DOMDebugger.DOMBreakpointType.AttributeModified, i18nString(UIStrings.attributeModified)], + [Protocol.DOMDebugger.DOMBreakpointType.NodeRemoved, i18nString(UIStrings.nodeRemoved)], ]); /** @@ -372,7 +436,7 @@ export class ContextMenuProvider { } } - const breakpointsMenu = contextMenu.debugSection().appendSubMenuItem(Common.UIString.UIString('Break on')); + const breakpointsMenu = contextMenu.debugSection().appendSubMenuItem(i18nString(UIStrings.breakOn)); for (const type of Object.values(Protocol.DOMDebugger.DOMBreakpointType)) { const label = Sources.DebuggerPausedMessage.BreakpointTypeNouns.get(type); if (label) { diff --git a/front_end/browser_debugger/ModuleUIStrings.js b/front_end/browser_debugger/ModuleUIStrings.js new file mode 100644 index 0000000000..d02cbe70cb --- /dev/null +++ b/front_end/browser_debugger/ModuleUIStrings.js @@ -0,0 +1,12 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// 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'; +export const UIStrings = { + /** + *@description Title of the Marker Decorator of Elements + */ + domBreakpoint: 'DOM Breakpoint', +}; +i18n.i18n.registerUIStrings('browser_debugger/ModuleUIStrings.js', UIStrings); diff --git a/front_end/browser_debugger/ObjectEventListenersSidebarPane.js b/front_end/browser_debugger/ObjectEventListenersSidebarPane.js index 81ae0c8a46..3f4df54399 100644 --- a/front_end/browser_debugger/ObjectEventListenersSidebarPane.js +++ b/front_end/browser_debugger/ObjectEventListenersSidebarPane.js @@ -4,10 +4,18 @@ import * as Common from '../common/common.js'; // eslint-disable-line no-unused-vars import * as EventListeners from '../event_listeners/event_listeners.js'; -import {ls} from '../platform/platform.js'; +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 Label for a button in the sources panel that refreshes the list of global event listeners. + */ + refreshGlobalListeners: 'Refresh global listeners', +}; +const str_ = i18n.i18n.registerUIStrings('browser_debugger/ObjectEventListenersSidebarPane.js', UIStrings); +const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); /** @type {!ObjectEventListenersSidebarPane} */ let objectEventListenersSidebarPaneInstance; @@ -20,7 +28,8 @@ export class ObjectEventListenersSidebarPane extends UI.Widget.VBox { */ constructor() { super(); - this._refreshButton = new UI.Toolbar.ToolbarButton(ls`Refresh global listeners`, 'largeicon-refresh'); + this._refreshButton = + new UI.Toolbar.ToolbarButton(i18nString(UIStrings.refreshGlobalListeners), 'largeicon-refresh'); this._refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._refreshClick, this); this._refreshButton.setEnabled(false); diff --git a/front_end/browser_debugger/XHRBreakpointsSidebarPane.js b/front_end/browser_debugger/XHRBreakpointsSidebarPane.js index c5b6c30309..a8de1303f0 100644 --- a/front_end/browser_debugger/XHRBreakpointsSidebarPane.js +++ b/front_end/browser_debugger/XHRBreakpointsSidebarPane.js @@ -2,11 +2,59 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import * as Common from '../common/common.js'; -import {ls} from '../platform/platform.js'; +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 Title of the 'XHR/fetch Breakpoints' tool in the bottom sidebar of the Sources tool + */ + xhrfetchBreakpoints: 'XHR/fetch Breakpoints', + /** + *@description Text to indicate there are no breakpoints + */ + noBreakpoints: 'No breakpoints', + /** + *@description Label for a button in the Sources panel that opens the input field to create a new XHR/fetch breakpoint. + */ + addXhrfetchBreakpoint: 'Add XHR/fetch breakpoint', + /** + *@description Text to add a breakpoint + */ + addBreakpoint: 'Add breakpoint', + /** + *@description Input element container text content in XHRBreakpoints Sidebar Pane of the JavaScript Debugging pane in the Sources panel or the DOM Breakpoints pane in the Elements panel + */ + breakWhenUrlContains: 'Break when URL contains:', + /** + *@description Accessible label for XHR/fetch breakpoint text input + */ + urlBreakpoint: 'URL Breakpoint', + /** + *@description Text in XHRBreakpoints Sidebar Pane of the JavaScript Debugging pane in the Sources panel or the DOM Breakpoints pane in the Elements panel + *@example {example.com} PH1 + */ + urlContainsS: 'URL contains "{PH1}"', + /** + *@description Text in XHRBreakpoints Sidebar Pane of the JavaScript Debugging pane in the Sources panel or the DOM Breakpoints pane in the Elements panel + */ + anyXhrOrFetch: 'Any XHR or fetch', + /** + *@description Screen reader description of a hit breakpoint in the Sources panel + */ + breakpointHit: 'breakpoint hit', + /** + *@description Text to remove all breakpoints + */ + removeAllBreakpoints: 'Remove all breakpoints', + /** + *@description Text to remove a breakpoint + */ + removeBreakpoint: 'Remove breakpoint', +}; +const str_ = i18n.i18n.registerUIStrings('browser_debugger/XHRBreakpointsSidebarPane.js', UIStrings); +const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); /** * @type {!WeakMap} */ @@ -39,14 +87,14 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox { this.contentElement.appendChild(this._list.element); this._list.element.classList.add('breakpoint-list', 'hidden'); UI.ARIAUtils.markAsList(this._list.element); - UI.ARIAUtils.setAccessibleName(this._list.element, ls`XHR/fetch Breakpoints`); + UI.ARIAUtils.setAccessibleName(this._list.element, i18nString(UIStrings.xhrfetchBreakpoints)); this._emptyElement = this.contentElement.createChild('div', 'gray-info-message'); - this._emptyElement.textContent = Common.UIString.UIString('No breakpoints'); + this._emptyElement.textContent = i18nString(UIStrings.noBreakpoints); /** @type {!Map.} */ this._breakpointElements = new Map(); - this._addButton = new UI.Toolbar.ToolbarButton(ls`Add XHR/fetch breakpoint`, 'largeicon-add'); + this._addButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.addXhrfetchBreakpoint), 'largeicon-add'); this._addButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, event => { this._addButtonClicked(); }); @@ -77,8 +125,7 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox { */ _emptyElementContextMenu(event) { const contextMenu = new UI.ContextMenu.ContextMenu(event); - contextMenu.defaultSection().appendItem( - Common.UIString.UIString('Add breakpoint'), this._addButtonClicked.bind(this)); + contextMenu.defaultSection().appendItem(i18nString(UIStrings.addBreakpoint), this._addButtonClicked.bind(this)); contextMenu.show(); } @@ -87,10 +134,10 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox { const inputElementContainer = document.createElement('p'); inputElementContainer.classList.add('breakpoint-condition'); - inputElementContainer.textContent = Common.UIString.UIString('Break when URL contains:'); + inputElementContainer.textContent = i18nString(UIStrings.breakWhenUrlContains); const inputElement = inputElementContainer.createChild('span', 'breakpoint-condition-input'); - UI.ARIAUtils.setAccessibleName(inputElement, ls`URL Breakpoint`); + UI.ARIAUtils.setAccessibleName(inputElement, i18nString(UIStrings.urlBreakpoint)); this._addListElement(inputElementContainer, /** @type {?Element} */ (this._list.element.firstChild)); /** @@ -167,8 +214,7 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox { UI.ARIAUtils.setChecked(element, enabled); element.addEventListener('contextmenu', this._contextMenu.bind(this, item), true); - const title = - item ? Common.UIString.UIString('URL contains "%s"', item) : Common.UIString.UIString('Any XHR or fetch'); + const title = item ? i18nString(UIStrings.urlContainsS, {PH1: item}) : i18nString(UIStrings.anyXhrOrFetch); const label = UI.UIUtils.CheckboxLabel.create(title, enabled); UI.ARIAUtils.markAsHidden(label); UI.ARIAUtils.setAccessibleName(element, title); @@ -203,7 +249,7 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox { if (item === this._hitBreakpoint) { element.classList.add('breakpoint-hit'); - UI.ARIAUtils.setDescription(element, ls`breakpoint hit`); + UI.ARIAUtils.setDescription(element, i18nString(UIStrings.breakpointHit)); } label.classList.add('cursor-auto'); @@ -307,11 +353,10 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox { } this._update(); } - const removeAllTitle = Common.UIString.UIString('Remove all breakpoints'); + const removeAllTitle = i18nString(UIStrings.removeAllBreakpoints); - contextMenu.defaultSection().appendItem( - Common.UIString.UIString('Add breakpoint'), this._addButtonClicked.bind(this)); - contextMenu.defaultSection().appendItem(Common.UIString.UIString('Remove breakpoint'), removeBreakpoint.bind(this)); + contextMenu.defaultSection().appendItem(i18nString(UIStrings.addBreakpoint), this._addButtonClicked.bind(this)); + contextMenu.defaultSection().appendItem(i18nString(UIStrings.removeBreakpoint), removeBreakpoint.bind(this)); contextMenu.defaultSection().appendItem(removeAllTitle, removeAllBreakpoints.bind(this)); contextMenu.show(); } diff --git a/front_end/browser_debugger/browser_debugger-meta.ts b/front_end/browser_debugger/browser_debugger-meta.ts index 347cc9065c..4ae47f54da 100644 --- a/front_end/browser_debugger/browser_debugger-meta.ts +++ b/front_end/browser_debugger/browser_debugger-meta.ts @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import type * as Platform from '../platform/platform.js'; -import {ls} from '../platform/platform.js'; import * as Root from '../root/root.js'; import * as UI from '../ui/ui.js'; @@ -11,6 +9,75 @@ import * as UI from '../ui/ui.js'; import type * as BrowserDebugger from './browser_debugger.js'; import type * as Sources from '../sources/sources.js'; +import * as i18n from '../i18n/i18n.js'; +export const UIStrings = { + /** + *@description Command for showing the 'Elements' tool + */ + showElements: 'Show Elements', + /** + *@description Title of the 'Event Listener Breakpoints' tool in the bottom sidebar of the Sources tool + */ + eventListenerBreakpoints: 'Event Listener Breakpoints', + /** + *@description Title for showing the 'CSP Violation Breakpoints' tool in the Sources panel + */ + showCspViolationBreakpoints: 'Show CSP Violation Breakpoints', + /** + *@description Title of the 'CSP Violation Breakpoints' tool in the bottom sidebar of the Sources tool + */ + cspViolationBreakpoints: 'CSP Violation Breakpoints', + /** + *@description Command for showing the 'XHR/fetch Breakpoints' in the sources panel + */ + showXhrfetchBreakpoints: 'Show XHR/fetch Breakpoints', + /** + *@description Title of the 'XHR/fetch Breakpoints' tool in the bottom sidebar of the Sources tool + */ + xhrfetchBreakpoints: 'XHR/fetch Breakpoints', + /** + *@description Command for showing the 'DOM Breakpoints' tool in the Elements panel + */ + showDomBreakpoints: 'Show DOM Breakpoints', + /** + *@description Title of the 'DOM Breakpoints' tool in the bottom sidebar of the Sources tool + */ + domBreakpoints: 'DOM Breakpoints', + /** + *@description Command for showing the 'Gobal Listeners' tool in the sources panel + */ + showGlobalListeners: 'Show Global Listeners', + /** + *@description Title of the 'Global Listeners' tool in the bottom sidebar of the Sources tool + */ + globalListeners: 'Global Listeners', + /** + *@description Text that refers to one or a group of webpages + */ + page: 'Page', + /** + *@description Command for showing the 'Page' tab in the Sources panel + */ + showPage: 'Show Page', + /** + *@description Title as part of a tool to override existing configurations + */ + overrides: 'Overrides', + /** + *@description Command for showing the 'Overrides' tool in the Sources panel + */ + showOverrides: 'Show Overrides', + /** + *@description Title for a type of source files + */ + contentScripts: 'Content scripts', + /** + *@description Command for showing the 'Content scripts' tool in the sources panel + */ + showContentScripts: 'Show Content scripts', +}; +const str_ = i18n.i18n.registerUIStrings('browser_debugger/browser_debugger-meta.ts', UIStrings); +const i18nString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_); let loadedBrowserDebuggerModule: (typeof BrowserDebugger|undefined); async function loadBrowserDebuggerModule(): Promise { @@ -45,8 +112,8 @@ UI.ViewManager.registerViewExtension({ }, id: 'sources.eventListenerBreakpoints', location: UI.ViewManager.ViewLocationValues.SOURCES_SIDEBAR_BOTTOM, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show Elements`, - title: (): Platform.UIString.LocalizedString => ls`Event Listener Breakpoints`, + commandPrompt: i18nString(UIStrings.showElements), + title: i18nString(UIStrings.eventListenerBreakpoints), order: 9, persistence: UI.ViewManager.ViewPersistence.PERMANENT, }); @@ -58,8 +125,8 @@ UI.ViewManager.registerViewExtension({ }, id: 'sources.cspViolationBreakpoints', location: UI.ViewManager.ViewLocationValues.SOURCES_SIDEBAR_BOTTOM, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show CSP Violation Breakpoints`, - title: (): Platform.UIString.LocalizedString => ls`CSP Violation Breakpoints`, + commandPrompt: i18nString(UIStrings.showCspViolationBreakpoints), + title: i18nString(UIStrings.cspViolationBreakpoints), order: 10, persistence: UI.ViewManager.ViewPersistence.PERMANENT, }); @@ -71,8 +138,8 @@ UI.ViewManager.registerViewExtension({ }, id: 'sources.xhrBreakpoints', location: UI.ViewManager.ViewLocationValues.SOURCES_SIDEBAR_BOTTOM, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show XHR/fetch Breakpoints`, - title: (): Platform.UIString.LocalizedString => ls`XHR/fetch Breakpoints`, + commandPrompt: i18nString(UIStrings.showXhrfetchBreakpoints), + title: i18nString(UIStrings.xhrfetchBreakpoints), order: 5, persistence: UI.ViewManager.ViewPersistence.PERMANENT, hasToolbar: true, @@ -85,8 +152,8 @@ UI.ViewManager.registerViewExtension({ }, id: 'sources.domBreakpoints', location: UI.ViewManager.ViewLocationValues.SOURCES_SIDEBAR_BOTTOM, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show DOM Breakpoints`, - title: (): Platform.UIString.LocalizedString => ls`DOM Breakpoints`, + commandPrompt: i18nString(UIStrings.showDomBreakpoints), + title: i18nString(UIStrings.domBreakpoints), order: 7, persistence: UI.ViewManager.ViewPersistence.PERMANENT, }); @@ -98,8 +165,8 @@ UI.ViewManager.registerViewExtension({ }, id: 'sources.globalListeners', location: UI.ViewManager.ViewLocationValues.SOURCES_SIDEBAR_BOTTOM, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show Global Listeners`, - title: (): Platform.UIString.LocalizedString => ls`Global Listeners`, + commandPrompt: i18nString(UIStrings.showGlobalListeners), + title: i18nString(UIStrings.globalListeners), order: 8, persistence: UI.ViewManager.ViewPersistence.PERMANENT, hasToolbar: true, @@ -112,8 +179,8 @@ UI.ViewManager.registerViewExtension({ }, id: 'elements.domBreakpoints', location: UI.ViewManager.ViewLocationValues.ELEMENTS_SIDEBAR, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show DOM Breakpoints`, - title: (): Platform.UIString.LocalizedString => ls`DOM Breakpoints`, + commandPrompt: i18nString(UIStrings.showDomBreakpoints), + title: i18nString(UIStrings.domBreakpoints), order: 6, persistence: UI.ViewManager.ViewPersistence.PERMANENT, }); @@ -122,8 +189,8 @@ UI.ViewManager.registerViewExtension({ UI.ViewManager.registerViewExtension({ location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW, id: 'navigator-network', - title: (): Platform.UIString.LocalizedString => ls`Page`, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show Page`, + title: i18nString(UIStrings.page), + commandPrompt: i18nString(UIStrings.showPage), order: 2, persistence: UI.ViewManager.ViewPersistence.PERMANENT, async loadView() { @@ -135,8 +202,8 @@ UI.ViewManager.registerViewExtension({ UI.ViewManager.registerViewExtension({ location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW, id: 'navigator-overrides', - title: (): Platform.UIString.LocalizedString => ls`Overrides`, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show Overrides`, + title: i18nString(UIStrings.overrides), + commandPrompt: i18nString(UIStrings.showOverrides), order: 4, persistence: UI.ViewManager.ViewPersistence.PERMANENT, async loadView() { @@ -148,8 +215,8 @@ UI.ViewManager.registerViewExtension({ UI.ViewManager.registerViewExtension({ location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW, id: 'navigator-contentScripts', - title: (): Platform.UIString.LocalizedString => ls`Content scripts`, - commandPrompt: (): Platform.UIString.LocalizedString => ls`Show Content scripts`, + title: i18nString(UIStrings.contentScripts), + commandPrompt: i18nString(UIStrings.showContentScripts), order: 5, persistence: UI.ViewManager.ViewPersistence.PERMANENT, async loadView() { diff --git a/front_end/browser_debugger/browser_debugger_strings.grdp b/front_end/browser_debugger/browser_debugger_strings.grdp deleted file mode 100644 index fc016a7ba9..0000000000 --- a/front_end/browser_debugger/browser_debugger_strings.grdp +++ /dev/null @@ -1,87 +0,0 @@ - - - - Show DOM Breakpoints - - - XHR/fetch Breakpoints - - - Attribute modified - - - Break when URL contains: - - - Content scripts - - - Remove all DOM breakpoints - - - breakpoint hit - - - Show Global Listeners - - - Reveal DOM node in Elements panel - - - Break on - - - Show Page - - - DOM Breakpoint - - - DOM Breakpoints - - - Show CSP Violation Breakpoints - - - Refresh global listeners - - - URL Breakpoint - - - Any XHR or fetch - - - URL contains "$1sexample.com" - - - Subtree modified - - - Show Content scripts - - - Show XHR/fetch Breakpoints - - - Global Listeners - - - DOM Breakpoints list - - - CSP Violation Breakpoints - - - Event Listener Breakpoints - - - Show Overrides - - - Add XHR/fetch breakpoint - - - Node removed - - diff --git a/front_end/browser_debugger/module.json b/front_end/browser_debugger/module.json index ed9a142593..97d6849364 100644 --- a/front_end/browser_debugger/module.json +++ b/front_end/browser_debugger/module.json @@ -42,7 +42,8 @@ "dependencies": [ "elements", "sources", - "console" + "console", + "i18n" ], "modules": [ "browser_debugger-legacy.js" diff --git a/front_end/elements/elements_strings.grdp b/front_end/elements/elements_strings.grdp index 3716e71deb..364c4e2539 100644 --- a/front_end/elements/elements_strings.grdp +++ b/front_end/elements/elements_strings.grdp @@ -36,6 +36,9 @@ Reveal in Elements panel + + Show Elements + Store as global variable diff --git a/front_end/emulation/emulation_strings.grdp b/front_end/emulation/emulation_strings.grdp index 6f3040693b..8657dd2f6e 100644 --- a/front_end/emulation/emulation_strings.grdp +++ b/front_end/emulation/emulation_strings.grdp @@ -12,6 +12,9 @@ Device-based + + Overrides + accelerometer diff --git a/front_end/i18n/locales/en-US.json b/front_end/i18n/locales/en-US.json index 3af386c5f4..10adaf1328 100644 --- a/front_end/i18n/locales/en-US.json +++ b/front_end/i18n/locales/en-US.json @@ -467,6 +467,138 @@ "animation/AnimationUI.ts | sSlider": { "message": "{PH1} slider" }, + "browser_debugger/browser_debugger-meta.ts | contentScripts": { + "message": "Content scripts" + }, + "browser_debugger/browser_debugger-meta.ts | cspViolationBreakpoints": { + "message": "CSP Violation Breakpoints" + }, + "browser_debugger/browser_debugger-meta.ts | domBreakpoints": { + "message": "DOM Breakpoints" + }, + "browser_debugger/browser_debugger-meta.ts | eventListenerBreakpoints": { + "message": "Event Listener Breakpoints" + }, + "browser_debugger/browser_debugger-meta.ts | globalListeners": { + "message": "Global Listeners" + }, + "browser_debugger/browser_debugger-meta.ts | overrides": { + "message": "Overrides" + }, + "browser_debugger/browser_debugger-meta.ts | page": { + "message": "Page" + }, + "browser_debugger/browser_debugger-meta.ts | showContentScripts": { + "message": "Show Content scripts" + }, + "browser_debugger/browser_debugger-meta.ts | showCspViolationBreakpoints": { + "message": "Show CSP Violation Breakpoints" + }, + "browser_debugger/browser_debugger-meta.ts | showDomBreakpoints": { + "message": "Show DOM Breakpoints" + }, + "browser_debugger/browser_debugger-meta.ts | showElements": { + "message": "Show Elements" + }, + "browser_debugger/browser_debugger-meta.ts | showGlobalListeners": { + "message": "Show Global Listeners" + }, + "browser_debugger/browser_debugger-meta.ts | showOverrides": { + "message": "Show Overrides" + }, + "browser_debugger/browser_debugger-meta.ts | showPage": { + "message": "Show Page" + }, + "browser_debugger/browser_debugger-meta.ts | showXhrfetchBreakpoints": { + "message": "Show XHR/fetch Breakpoints" + }, + "browser_debugger/browser_debugger-meta.ts | xhrfetchBreakpoints": { + "message": "XHR/fetch Breakpoints" + }, + "browser_debugger/CategorizedBreakpointsSidebarPane.js | breakpointHit": { + "message": "breakpoint hit" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | attributeModified": { + "message": "Attribute modified" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | breakOn": { + "message": "Break on" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | breakpointHit": { + "message": "breakpoint hit" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | checked": { + "message": "checked" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | domBreakpointsList": { + "message": "DOM Breakpoints list" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | noBreakpoints": { + "message": "No breakpoints" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | nodeRemoved": { + "message": "Node removed" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | removeAllDomBreakpoints": { + "message": "Remove all DOM breakpoints" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | removeBreakpoint": { + "message": "Remove breakpoint" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | revealDomNodeInElementsPanel": { + "message": "Reveal DOM node in Elements panel" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | sBreakpointHit": { + "message": "{PH1} breakpoint hit" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | sS": { + "message": "{PH1}: {PH2}" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | subtreeModified": { + "message": "Subtree modified" + }, + "browser_debugger/DOMBreakpointsSidebarPane.js | unchecked": { + "message": "unchecked" + }, + "browser_debugger/ModuleUIStrings.js | domBreakpoint": { + "message": "DOM Breakpoint" + }, + "browser_debugger/ObjectEventListenersSidebarPane.js | refreshGlobalListeners": { + "message": "Refresh global listeners" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | addBreakpoint": { + "message": "Add breakpoint" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | addXhrfetchBreakpoint": { + "message": "Add XHR/fetch breakpoint" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | anyXhrOrFetch": { + "message": "Any XHR or fetch" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | breakpointHit": { + "message": "breakpoint hit" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | breakWhenUrlContains": { + "message": "Break when URL contains:" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | noBreakpoints": { + "message": "No breakpoints" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | removeAllBreakpoints": { + "message": "Remove all breakpoints" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | removeBreakpoint": { + "message": "Remove breakpoint" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | urlBreakpoint": { + "message": "URL Breakpoint" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | urlContainsS": { + "message": "URL contains \"{PH1}\"" + }, + "browser_debugger/XHRBreakpointsSidebarPane.js | xhrfetchBreakpoints": { + "message": "XHR/fetch Breakpoints" + }, "browser_sdk/browser_sdk-meta.ts | clear": { "message": "clear" }, diff --git a/front_end/langpacks/devtools_ui_strings.grd b/front_end/langpacks/devtools_ui_strings.grd index 39cfbc0cf1..ecf2d45b8e 100644 --- a/front_end/langpacks/devtools_ui_strings.grd +++ b/front_end/langpacks/devtools_ui_strings.grd @@ -12,7 +12,6 @@ - diff --git a/front_end/langpacks/shared_strings.grdp b/front_end/langpacks/shared_strings.grdp index 62a51258bd..8c6f741615 100644 --- a/front_end/langpacks/shared_strings.grdp +++ b/front_end/langpacks/shared_strings.grdp @@ -22,9 +22,6 @@ Enable network request blocking - - Overrides - Warning @@ -49,9 +46,6 @@ Service Worker - - Page - Drawer sidebar @@ -98,15 +92,9 @@ Frame - - Show Elements - Memory - - No breakpoints - Name @@ -173,9 +161,6 @@ None - - Remove all breakpoints - Size @@ -191,9 +176,6 @@ Manifest - - $1sNode removed: $2sdiv#id1 - Learn more @@ -218,9 +200,6 @@ Offline - - $1schecked breakpoint hit - Error @@ -287,9 +266,6 @@ All - - Add breakpoint - Description @@ -341,9 +317,6 @@ Learn more - - Remove breakpoint - Response diff --git a/front_end/sources/sources_strings.grdp b/front_end/sources/sources_strings.grdp index 722cec1378..7a741fceed 100644 --- a/front_end/sources/sources_strings.grdp +++ b/front_end/sources/sources_strings.grdp @@ -183,6 +183,9 @@ Select folder for overrides + + No breakpoints + Enable tab moves focus @@ -291,6 +294,9 @@ Paused on promise rejection + + Remove all breakpoints + (no domain) @@ -399,6 +405,9 @@ Could not open linear memory inspector: failed locating buffer. + + $1schecked breakpoint hit + Rename @@ -513,6 +522,9 @@ Are you sure you want to close unsaved file: $1sexample.file? + + Add breakpoint + Are you sure you want to remove this folder? @@ -570,6 +582,9 @@ Add script to ignore list + + Remove breakpoint + Show Watch diff --git a/front_end/timeline/timeline_strings.grdp b/front_end/timeline/timeline_strings.grdp index 9a67357d7b..d547a2c19e 100644 --- a/front_end/timeline/timeline_strings.grdp +++ b/front_end/timeline/timeline_strings.grdp @@ -124,6 +124,9 @@ Click the reload button $3sreload or hit < Finish Loading + + Page + Listeners: $1s17 @@ -595,6 +598,9 @@ Click the reload button $3sreload or hit < Previous recording + + $1sNode removed: $2sdiv#id1 + $1sblink.console (self) diff --git a/scripts/localization/utils/check_localized_strings.js b/scripts/localization/utils/check_localized_strings.js index 429702ce7a..443b150b27 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([ 'accessibility', 'animation', + 'browser_debugger', 'browser_sdk', 'changes', 'color_picker',