Bug 1121110 - Add a shared.properties file for localizing strings used across tools;r=vporof

This commit is contained in:
Brian Grinstead 2015-01-28 11:57:27 -08:00
parent aca31e4667
commit 003106ce96
6 changed files with 23 additions and 5 deletions

View File

@ -70,7 +70,8 @@ const EVENTS = {
};
const HTML_NS = "http://www.w3.org/1999/xhtml";
const STRINGS_URI = "chrome://browser/locale/devtools/canvasdebugger.properties"
const STRINGS_URI = "chrome://browser/locale/devtools/canvasdebugger.properties";
const SHARED_STRINGS_URI = "chrome://browser/locale/devtools/shared.properties";
const SNAPSHOT_START_RECORDING_DELAY = 10; // ms
const SNAPSHOT_DATA_EXPORT_MAX_BLOCK = 1000; // ms
@ -701,7 +702,8 @@ let CallsListView = Heritage.extend(WidgetMethods, {
let dimensionsNode = $("#screenshot-dimensions");
let actualWidth = (width / scaling) | 0;
let actualHeight = (height / scaling) | 0;
dimensionsNode.setAttribute("value", actualWidth + " \u00D7 " + actualHeight);
dimensionsNode.setAttribute("value",
SHARED_L10N.getFormatStr("dimensions", actualWidth, actualHeight));
window.emit(EVENTS.CALL_SCREENSHOT_DISPLAYED);
},
@ -1050,6 +1052,7 @@ let CallsListView = Heritage.extend(WidgetMethods, {
* Localization convenience methods.
*/
let L10N = new ViewHelpers.L10N(STRINGS_URI);
let SHARED_L10N = new ViewHelpers.L10N(SHARED_STRINGS_URI);
/**
* Convenient way of emitting events from the panel window.

View File

@ -20,7 +20,7 @@ function ifTestingSupported() {
is($("#screenshot-container").hidden, false,
"The screenshot container should now be visible.");
is($("#screenshot-dimensions").getAttribute("value"), "128" + " \u00D7 " + "128",
is($("#screenshot-dimensions").getAttribute("value"), "128" + "\u00D7" + "128",
"The screenshot dimensions label has the expected value.");
is($("#screenshot-image").getAttribute("flipped"), "false",

View File

@ -14,12 +14,14 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/devtools/Loader.jsm");
Cu.import("resource://gre/modules/devtools/Console.jsm");
Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
const {InplaceEditor, editableItem} = devtools.require("devtools/shared/inplace-editor");
const {parseDeclarations} = devtools.require("devtools/styleinspector/css-parsing-utils");
const {ReflowFront} = devtools.require("devtools/server/actors/layout");
const SHARED_L10N = new ViewHelpers.L10N("chrome://browser/locale/devtools/shared.properties");
const NUMERIC = /^-?[\d\.]+$/;
const LONG_TEXT_ROTATE_LIMIT = 3;
@ -401,7 +403,8 @@ LayoutView.prototype = {
this._lastRequest = null;
let width = layout.width;
let height = layout.height;
let newLabel = width + "\u00D7" + height;
let newLabel = SHARED_L10N.getFormatStr("dimensions", width, height);
if (this.sizeHeadingLabel.textContent != newLabel) {
this.sizeHeadingLabel.textContent = newLabel;
}

View File

@ -11,6 +11,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/devtools/gDevTools.jsm");
Cu.import("resource://gre/modules/devtools/event-emitter.js");
Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy",
"resource://gre/modules/SystemAppProxy.jsm");
@ -33,6 +34,8 @@ const ROUND_RATIO = 10;
const INPUT_PARSER = /(\d+)[^\d]+(\d+)/;
const SHARED_L10N = new ViewHelpers.L10N("chrome://browser/locale/devtools/shared.properties");
let ActiveTabs = new Map();
this.ResponsiveUIManager = {
@ -604,7 +607,8 @@ ResponsiveUI.prototype = {
* @param aPreset associated preset.
*/
setMenuLabel: function RUI_setMenuLabel(aMenuitem, aPreset) {
let size = Math.round(aPreset.width) + "\u00D7" + Math.round(aPreset.height);
let size = SHARED_L10N.getFormatStr("dimensions",
Math.round(aPreset.width), Math.round(aPreset.height));
// .inputField might be not reachable yet (async XBL loading)
if (this.menulist.inputField) {

View File

@ -0,0 +1,7 @@
# 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 (dimensions): This is used to display the dimensions
# of a node or image, like 100×200.
dimensions=%S\u00D7%S

View File

@ -45,6 +45,7 @@
locale/browser/devtools/webconsole.properties (%chrome/browser/devtools/webconsole.properties)
locale/browser/devtools/inspector.properties (%chrome/browser/devtools/inspector.properties)
locale/browser/devtools/tilt.properties (%chrome/browser/devtools/tilt.properties)
locale/browser/devtools/shared.properties (%chrome/browser/devtools/shared.properties)
locale/browser/devtools/scratchpad.properties (%chrome/browser/devtools/scratchpad.properties)
locale/browser/devtools/scratchpad.dtd (%chrome/browser/devtools/scratchpad.dtd)
locale/browser/devtools/storage.properties (%chrome/browser/devtools/storage.properties)