Bug 1214799 - Localization strings for the memory tool. r=fitzgen

This commit is contained in:
Jordan Santell 2015-10-28 23:34:59 -07:00
parent 7f37fbedaa
commit 1b520cae71
9 changed files with 158 additions and 38 deletions

View File

@ -0,0 +1,103 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# LOCALIZATION NOTE These strings are used inside the Memory Tools
# which is available from the Web Developer sub-menu -> 'Memory'.
# The correct localization of this file might be to keep it in
# English, or another language commonly spoken among web developers.
# You want to make that choice consistent across the developer tools.
# A good criteria is the language in which you'd find the best
# documentation on web development on the web.
# LOCALIZATION NOTE (memory.label):
# This string is displayed in the title of the tab when the memory tool is
# displayed inside the developer tools window and in the Developer Tools Menu.
memory.label=Memory
# LOCALIZATION NOTE (memory.panelLabel):
# This is used as the label for the toolbox panel.
memory.panelLabel=Memory Panel
# LOCALIZATION NOTE (memory.tooltip):
# This string is displayed in the tooltip of the tab when the memory tool is
# displayed inside the developer tools window.
memory.tooltip=Memory
# LOCALIZATION NOTE (checkbox.invertTree): The label describing the boolean
# checkbox whether or not to invert the tree.
checkbox.invertTree=Invert tree
# LOCALIZATION NOTE (checkbox.recordAllocationStacks): The label describing the boolean
# checkbox whether or not to record allocation stacks.
checkbox.recordAllocationStacks=Record allocation stacks
# LOCALIZATION NOTE (toolbar.breakdownBy): The label describing the select menu
# options of the breakdown options.
toolbar.breakdownBy=Group by:
# LOCALIZATION NOTE (take-snapshot): The label describing the button that initiates
# taking a snapshot, either as the main label, or a tooltip.
take-snapshot=Take snapshot
# LOCALIZATION NOTE (viewsourceindebugger): The label for the tooltip when hovering over
# a link in the heap tree to jump to the debugger view.
# %S represents the URL to match in the debugger.
viewsourceindebugger=View source in Debugger → %S
# LOCALIZATION NOTE (tree-item.nostack): The label describing the row in the heap tree
# that represents a row broken down by allocation stack when no stack was available.
tree-item.nostack=(no stack available)
# LOCALIZATION NOTE (tree-item.root): The label describing the row in the heap tree
# that represents the root of the tree when inverted.
tree-item.root=(root)
# LOCALIZATION NOTE (snapshot.state.saving.full): The label describing the snapshot
# state SAVING, used in the main heap view.
snapshot.state.saving.full=Saving snapshot…
# LOCALIZATION NOTE (snapshot.state.reading.full): The label describing the snapshot
# state READING, and SAVED, due to these states being combined visually, used
# in the main heap view.
snapshot.state.reading.full=Reading snapshot…
# LOCALIZATION NOTE (snapshot.state.saving-census.full): The label describing the snapshot
# state SAVING, used in the main heap view.
snapshot.state.saving-census.full=Saving census…
# LOCALIZATION NOTE (snapshot.state.error.full): The label describing the snapshot
# state ERROR, used in the main heap view.
snapshot.state.error.full=There was an error processing this snapshot.
# LOCALIZATION NOTE (snapshot.state.saving): The label describing the snapshot
# state SAVING, used in the snapshot list view
snapshot.state.saving=Saving snapshot…
# LOCALIZATION NOTE (snapshot.state.reading): The label describing the snapshot
# state READING, and SAVED, due to these states being combined visually, used
# in the snapshot list view.
snapshot.state.reading=Reading snapshot…
# LOCALIZATION NOTE (snapshot.state.saving-census): The label describing the snapshot
# state SAVING, used in snapshot list view.
snapshot.state.saving-census=Saving census…
# LOCALIZATION NOTE (snapshot.state.error): The label describing the snapshot
# state ERROR, used in the snapshot list view.
snapshot.state.error=Error
# LOCALIZATION NOTE (heapview.field.bytes): The name of the column in the heap view for bytes.
heapview.field.bytes=Bytes
# LOCALIZATION NOTE (heapview.field.count): The name of the column in the heap view for count.
heapview.field.count=Count
# LOCALIZATION NOTE (heapview.field.totalbytes): The name of the column in the heap view for total bytes.
heapview.field.totalbytes=Total Bytes
# LOCALIZATION NOTE (heapview.field.totalcount): The name of the column in the heap view for total count.
heapview.field.totalcount=Total Count
# LOCALIZATION NOTE (heapview.field.name): The name of the column in the heap view for name.
heapview.field.name=Name

View File

@ -65,6 +65,7 @@
locale/browser/devtools/promisedebugger.properties (%chrome/browser/devtools/promisedebugger.properties)
locale/browser/devtools/performance.dtd (%chrome/browser/devtools/performance.dtd)
locale/browser/devtools/performance.properties (%chrome/browser/devtools/performance.properties)
locale/browser/devtools/memory.properties (%chrome/browser/devtools/memory.properties)
locale/browser/devtools/graphs.properties (%chrome/browser/devtools/graphs.properties)
locale/browser/devtools/layoutview.dtd (%chrome/browser/devtools/layoutview.dtd)
locale/browser/devtools/responsiveUI.properties (%chrome/browser/devtools/responsiveUI.properties)

View File

@ -38,6 +38,7 @@ const performanceProps = "chrome://browser/locale/devtools/performance.propertie
const netMonitorProps = "chrome://browser/locale/devtools/netmonitor.properties";
const storageProps = "chrome://browser/locale/devtools/storage.properties";
const scratchpadProps = "chrome://browser/locale/devtools/scratchpad.properties";
const memoryProps = "chrome://browser/locale/devtools/memory.properties";
loader.lazyGetter(this, "toolboxStrings", () => Services.strings.createBundle(toolboxProps));
loader.lazyGetter(this, "performanceStrings",() => Services.strings.createBundle(performanceProps));
@ -51,6 +52,7 @@ loader.lazyGetter(this, "inspectorStrings", () => Services.strings.createBundle(
loader.lazyGetter(this, "netMonitorStrings", () => Services.strings.createBundle(netMonitorProps));
loader.lazyGetter(this, "storageStrings", () => Services.strings.createBundle(storageProps));
loader.lazyGetter(this, "scratchpadStrings", () => Services.strings.createBundle(scratchpadProps));
loader.lazyGetter(this, "memoryStrings", () => Services.strings.createBundle(memoryProps));
var Tools = {};
exports.Tools = Tools;
@ -283,9 +285,9 @@ Tools.memory = {
highlightedicon: "chrome://devtools/skin/themes/images/tool-memory-active.svg",
url: "chrome://devtools/content/memory/memory.xhtml",
visibilityswitch: "devtools.memory.enabled",
label: "Memory",
panelLabel: "Memory Panel",
tooltip: "Memory (keyboardshortcut)",
label: l10n("memory.label", memoryStrings),
panelLabel: l10n("memory.panelLabel", memoryStrings),
tooltip: l10n("memory.tooltip", memoryStrings),
isTargetSupported: function (target) {
return target.getTrait("heapSnapshots");

View File

@ -3,6 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const { DOM: dom, createClass, PropTypes } = require("devtools/client/shared/vendor/react");
const { L10N } = require("../utils");
const { URL } = require("sdk/url");
const Frame = module.exports = createClass({
@ -20,11 +21,12 @@ const Frame = module.exports = createClass({
let spec = url.toString();
let func = frame.functionDisplayName || "";
let tooltip = `${func} (${spec}:${frame.line}:${frame.column})`;
let viewTooltip = L10N.getFormatStr("viewsourceindebugger", `${spec}:${frame.line}:${frame.column}`);
let onClick = () => toolbox.viewSourceInDebugger(spec, frame.line);
let fields = [
dom.span({ className: "frame-link-function-display-name" }, func),
dom.a({ className: "frame-link-filename", onClick }, url.fileName),
dom.a({ className: "frame-link-filename", onClick, title: viewTooltip }, url.fileName),
dom.span({ className: "frame-link-colon" }, ":"),
dom.span({ className: "frame-link-line" }, frame.line),
dom.span({ className: "frame-link-colon" }, ":"),

View File

@ -6,10 +6,9 @@ const { DOM: dom, createClass, PropTypes, createFactory } = require("devtools/cl
const { safeErrorString } = require("devtools/shared/DevToolsUtils");
const Tree = createFactory(require("./tree"));
const TreeItem = createFactory(require("./tree-item"));
const { getSnapshotStatusTextFull } = require("../utils");
const { getSnapshotStatusTextFull, L10N } = require("../utils");
const { snapshotState: states } = require("../constants");
const { snapshot: snapshotModel } = require("../models");
const TAKE_SNAPSHOT_TEXT = "Take snapshot";
// If HEAP_TREE_ROW_HEIGHT changes, be sure to change `var(--heap-tree-row-height)`
// in `devtools/client/themes/memory.css`
const HEAP_TREE_ROW_HEIGHT = 14;
@ -83,12 +82,12 @@ const Heap = module.exports = createClass({
// but React hates that evidently
"data-standalone": true,
"data-text-only": true,
}, TAKE_SNAPSHOT_TEXT)];
}, L10N.getStr("take-snapshot"))];
break;
case states.ERROR:
content = [
dom.span({ className: "snapshot-status error" }, statusText),
dom.pre({}, safeErrorString(snapshot.error || new Error("blahblah"))),
dom.pre({}, safeErrorString(snapshot.error))
];
break;
case states.SAVING:
@ -101,11 +100,11 @@ const Heap = module.exports = createClass({
case states.SAVED_CENSUS:
content = [
dom.div({ className: "header" },
dom.span({ className: "heap-tree-item-bytes" }, "Bytes"),
dom.span({ className: "heap-tree-item-count" }, "Count"),
dom.span({ className: "heap-tree-item-total-bytes" }, "Total Bytes"),
dom.span({ className: "heap-tree-item-total-count" }, "Total Count"),
dom.span({ className: "heap-tree-item-name" }, "Name")
dom.span({ className: "heap-tree-item-bytes" }, L10N.getStr("heapview.field.bytes")),
dom.span({ className: "heap-tree-item-count" }, L10N.getStr("heapview.field.count")),
dom.span({ className: "heap-tree-item-total-bytes" }, L10N.getStr("heapview.field.totalbytes")),
dom.span({ className: "heap-tree-item-total-count" }, L10N.getStr("heapview.field.totalcount")),
dom.span({ className: "heap-tree-item-name" }, L10N.getStr("heapview.field.name"))
),
Tree(createTreeProperties(snapshot.census, toolbox))
];

View File

@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const { DOM: dom, createClass, PropTypes } = require("devtools/client/shared/vendor/react");
const { getSnapshotStatusText } = require("../utils");
const { L10N, getSnapshotStatusText } = require("../utils");
const { snapshot: snapshotModel } = require("../models");
const SnapshotListItem = module.exports = createClass({

View File

@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const { DOM: dom, createClass, PropTypes } = require("devtools/client/shared/vendor/react");
const { L10N } = require("../utils");
const models = require("../models");
const Toolbar = module.exports = createClass({
@ -34,10 +34,14 @@ const Toolbar = module.exports = createClass({
return (
dom.div({ className: "devtools-toolbar" },
dom.button({ className: `take-snapshot devtools-button`, onClick: onTakeSnapshotClick }),
dom.button({
className: `take-snapshot devtools-button`,
onClick: onTakeSnapshotClick,
title: L10N.getStr("take-snapshot")
}),
dom.label({},
"Breakdown by ",
L10N.getStr("toolbar.breakdownBy"),
dom.select({
id: "select-breakdown",
className: `select-breakdown`,
@ -52,8 +56,7 @@ const Toolbar = module.exports = createClass({
checked: inverted,
onChange: onToggleInverted,
}),
// TODO bug 1214799
"Invert tree"
L10N.getStr("checkbox.invertTree")
),
dom.label({},
@ -63,8 +66,7 @@ const Toolbar = module.exports = createClass({
disabled: allocations.togglingInProgress,
onChange: onToggleRecordAllocationStacks,
}),
// TODO bug 1214799
"Record allocation stacks"
L10N.getStr("checkbox.recordAllocationStacks")
)
)
);

View File

@ -4,6 +4,7 @@
const { isSavedFrame } = require("devtools/shared/DevToolsUtils");
const { DOM: dom, createClass, createFactory, PropTypes } = require("devtools/client/shared/vendor/react");
const { L10N } = require("../utils");
const FrameView = createFactory(require("./frame"));
const INDENT = 10;
@ -33,8 +34,9 @@ const TreeItem = module.exports = createClass({
},
toLabel(name, toolbox) {
return isSavedFrame(name)
? FrameView({ frame: name, toolbox })
: String(name);
return isSavedFrame(name) ? FrameView({ frame: name, toolbox }) :
name === "noStack" ? L10N.getStr("tree-item.nostack") :
name === null ? L10N.getStr("tree-item.root") :
String(name);
},
});

View File

@ -2,16 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { Cu } = require("chrome");
Cu.import("resource://devtools/client/shared/widgets/ViewHelpers.jsm");
const STRINGS_URI = "chrome://browser/locale/devtools/memory.properties"
const L10N = exports.L10N = new ViewHelpers.L10N(STRINGS_URI);
const { assert } = require("devtools/shared/DevToolsUtils");
const { Preferences } = require("resource://gre/modules/Preferences.jsm");
const CUSTOM_BREAKDOWN_PREF = "devtools.memory.custom-breakdowns";
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const { snapshotState: states, breakdowns } = require("./constants");
const FULL_ERROR_TEXT = "There was an error processing this snapshot.";
const ERROR_SNAPSHOT_TEXT = "⚠ Error!";
const SAVING_SNAPSHOT_TEXT = "Saving snapshot...";
const READING_SNAPSHOT_TEXT = "Reading snapshot...";
const SAVING_CENSUS_TEXT = "Taking heap census...";
/**
* Returns an array of objects with the unique key `name`
@ -98,17 +97,16 @@ exports.getSnapshotStatusText = function (snapshot) {
switch (snapshot.state) {
case states.ERROR:
return ERROR_SNAPSHOT_TEXT;
return L10N.getStr("snapshot.state.error");
case states.SAVING:
return SAVING_SNAPSHOT_TEXT;
return L10N.getStr("snapshot.state.saving");
case states.SAVED:
case states.READING:
return READING_SNAPSHOT_TEXT;
return L10N.getStr("snapshot.state.reading");
case states.SAVING_CENSUS:
return SAVING_CENSUS_TEXT;
// If it's read, it shouldn't have any label, as we could've cleared the
// census cache by changing the breakdown, and we should lazily
// go to SAVING_CENSUS. If it's SAVED_CENSUS, we have no status to display.
return L10N.getStr("snapshot.state.saving-census");
// Both READ and SAVED_CENSUS state do not have any message
// to show as other content will be displayed.
case states.READ:
case states.SAVED_CENSUS:
return "";
@ -130,9 +128,20 @@ exports.getSnapshotStatusTextFull = function (snapshot) {
`Snapshot must have expected state, found ${(snapshot || {}).state}.`);
switch (snapshot.state) {
case states.ERROR:
return FULL_ERROR_TEXT;
return L10N.getStr("snapshot.state.error.full");
case states.SAVING:
return L10N.getStr("snapshot.state.saving.full");
case states.SAVED:
case states.READING:
return L10N.getStr("snapshot.state.reading.full");
case states.SAVING_CENSUS:
return L10N.getStr("snapshot.state.saving-census.full");
// Both READ and SAVED_CENSUS state do not have any full message
// to show as other content will be displayed.
case states.READ:
case states.SAVED_CENSUS:
return "";
}
return exports.getSnapshotStatusText(snapshot);
}
/**