mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
5d6812e289
Move DevTools l10n files under /devtools/client and /devtools/shared. A script is attached to the bug for l10n repos to migrate their strings. --HG-- rename : browser/locales/en-US/chrome/browser/devtools/VariablesView.dtd => devtools/client/locales/en-US/VariablesView.dtd rename : browser/locales/en-US/chrome/browser/devtools/aboutdebugging.dtd => devtools/client/locales/en-US/aboutdebugging.dtd rename : browser/locales/en-US/chrome/browser/devtools/aboutdebugging.properties => devtools/client/locales/en-US/aboutdebugging.properties rename : browser/locales/en-US/chrome/browser/devtools/animationinspector.dtd => devtools/client/locales/en-US/animationinspector.dtd rename : browser/locales/en-US/chrome/browser/devtools/animationinspector.properties => devtools/client/locales/en-US/animationinspector.properties rename : browser/locales/en-US/chrome/browser/devtools/app-manager.properties => devtools/client/locales/en-US/app-manager.properties rename : browser/locales/en-US/chrome/browser/devtools/appcacheutils.properties => devtools/client/locales/en-US/appcacheutils.properties rename : browser/locales/en-US/chrome/browser/devtools/canvasdebugger.dtd => devtools/client/locales/en-US/canvasdebugger.dtd rename : browser/locales/en-US/chrome/browser/devtools/canvasdebugger.properties => devtools/client/locales/en-US/canvasdebugger.properties rename : browser/locales/en-US/chrome/browser/devtools/connection-screen.dtd => devtools/client/locales/en-US/connection-screen.dtd rename : browser/locales/en-US/chrome/browser/devtools/connection-screen.properties => devtools/client/locales/en-US/connection-screen.properties rename : browser/locales/en-US/chrome/browser/devtools/debugger.dtd => devtools/client/locales/en-US/debugger.dtd rename : browser/locales/en-US/chrome/browser/devtools/debugger.properties => devtools/client/locales/en-US/debugger.properties rename : browser/locales/en-US/chrome/browser/devtools/device.properties => devtools/client/locales/en-US/device.properties rename : browser/locales/en-US/chrome/browser/devtools/eyedropper.properties => devtools/client/locales/en-US/eyedropper.properties rename : browser/locales/en-US/chrome/browser/devtools/filterwidget.dtd => devtools/client/locales/en-US/filterwidget.dtd rename : browser/locales/en-US/chrome/browser/devtools/filterwidget.properties => devtools/client/locales/en-US/filterwidget.properties rename : browser/locales/en-US/chrome/browser/devtools/font-inspector.dtd => devtools/client/locales/en-US/font-inspector.dtd rename : browser/locales/en-US/chrome/browser/devtools/graphs.properties => devtools/client/locales/en-US/graphs.properties rename : browser/locales/en-US/chrome/browser/devtools/har.properties => devtools/client/locales/en-US/har.properties rename : browser/locales/en-US/chrome/browser/devtools/inspector.dtd => devtools/client/locales/en-US/inspector.dtd rename : browser/locales/en-US/chrome/browser/devtools/inspector.properties => devtools/client/locales/en-US/inspector.properties rename : browser/locales/en-US/chrome/browser/devtools/jsonview.properties => devtools/client/locales/en-US/jsonview.properties rename : browser/locales/en-US/chrome/browser/devtools/layoutview.dtd => devtools/client/locales/en-US/layoutview.dtd rename : browser/locales/en-US/chrome/browser/devtools/markers.properties => devtools/client/locales/en-US/markers.properties rename : browser/locales/en-US/chrome/browser/devtools/memory.properties => devtools/client/locales/en-US/memory.properties rename : browser/locales/en-US/chrome/browser/devtools/netmonitor.dtd => devtools/client/locales/en-US/netmonitor.dtd rename : browser/locales/en-US/chrome/browser/devtools/netmonitor.properties => devtools/client/locales/en-US/netmonitor.properties rename : browser/locales/en-US/chrome/browser/devtools/performance.dtd => devtools/client/locales/en-US/performance.dtd rename : browser/locales/en-US/chrome/browser/devtools/performance.properties => devtools/client/locales/en-US/performance.properties rename : browser/locales/en-US/chrome/browser/devtools/projecteditor.properties => devtools/client/locales/en-US/projecteditor.properties rename : browser/locales/en-US/chrome/browser/devtools/promisedebugger.dtd => devtools/client/locales/en-US/promisedebugger.dtd rename : browser/locales/en-US/chrome/browser/devtools/promisedebugger.properties => devtools/client/locales/en-US/promisedebugger.properties rename : browser/locales/en-US/chrome/browser/devtools/responsiveUI.properties => devtools/client/locales/en-US/responsiveUI.properties rename : browser/locales/en-US/chrome/browser/devtools/scratchpad.dtd => devtools/client/locales/en-US/scratchpad.dtd rename : browser/locales/en-US/chrome/browser/devtools/scratchpad.properties => devtools/client/locales/en-US/scratchpad.properties rename : browser/locales/en-US/chrome/browser/devtools/shadereditor.dtd => devtools/client/locales/en-US/shadereditor.dtd rename : browser/locales/en-US/chrome/browser/devtools/shadereditor.properties => devtools/client/locales/en-US/shadereditor.properties rename : browser/locales/en-US/chrome/browser/devtools/shared.properties => devtools/client/locales/en-US/shared.properties rename : browser/locales/en-US/chrome/browser/devtools/sourceeditor.dtd => devtools/client/locales/en-US/sourceeditor.dtd rename : browser/locales/en-US/chrome/browser/devtools/sourceeditor.properties => devtools/client/locales/en-US/sourceeditor.properties rename : browser/locales/en-US/chrome/browser/devtools/storage.properties => devtools/client/locales/en-US/storage.properties rename : browser/locales/en-US/chrome/browser/devtools/styleeditor.dtd => devtools/client/locales/en-US/styleeditor.dtd rename : browser/locales/en-US/chrome/browser/devtools/styleeditor.properties => devtools/client/locales/en-US/styleeditor.properties rename : browser/locales/en-US/chrome/browser/devtools/styleinspector.dtd => devtools/client/locales/en-US/styleinspector.dtd rename : browser/locales/en-US/chrome/browser/devtools/tilt.properties => devtools/client/locales/en-US/tilt.properties rename : browser/locales/en-US/chrome/browser/devtools/toolbox.dtd => devtools/client/locales/en-US/toolbox.dtd rename : browser/locales/en-US/chrome/browser/devtools/toolbox.properties => devtools/client/locales/en-US/toolbox.properties rename : browser/locales/en-US/chrome/browser/devtools/webConsole.dtd => devtools/client/locales/en-US/webConsole.dtd rename : browser/locales/en-US/chrome/browser/devtools/webaudioeditor.dtd => devtools/client/locales/en-US/webaudioeditor.dtd rename : browser/locales/en-US/chrome/browser/devtools/webaudioeditor.properties => devtools/client/locales/en-US/webaudioeditor.properties rename : browser/locales/en-US/chrome/browser/devtools/webconsole.properties => devtools/client/locales/en-US/webconsole.properties rename : browser/locales/en-US/chrome/browser/devtools/webide.dtd => devtools/client/locales/en-US/webide.dtd rename : browser/locales/en-US/chrome/browser/devtools/webide.properties => devtools/client/locales/en-US/webide.properties rename : toolkit/locales/en-US/chrome/global/devtools/csscoverage.dtd => devtools/shared/locales/en-US/csscoverage.dtd rename : toolkit/locales/en-US/chrome/global/devtools/csscoverage.properties => devtools/shared/locales/en-US/csscoverage.properties rename : toolkit/locales/en-US/chrome/global/devtools/debugger.properties => devtools/shared/locales/en-US/debugger.properties rename : toolkit/locales/en-US/chrome/global/devtools/gcli.properties => devtools/shared/locales/en-US/gcli.properties rename : toolkit/locales/en-US/chrome/global/devtools/gclicommands.properties => devtools/shared/locales/en-US/gclicommands.properties rename : toolkit/locales/en-US/chrome/global/devtools/styleinspector.properties => devtools/shared/locales/en-US/styleinspector.properties extra : commitid : 8hcm3tr7AAi
75 lines
2.3 KiB
JavaScript
75 lines
2.3 KiB
JavaScript
/* 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/. */
|
|
|
|
"use strict";
|
|
|
|
const { Ci, Cc } = require("chrome");
|
|
const { getJSON } = require("devtools/client/shared/getjson");
|
|
const { Services } = require("resource://gre/modules/Services.jsm");
|
|
const promise = require("promise");
|
|
|
|
const DEVICES_URL = "devtools.devices.url";
|
|
const Strings = Services.strings.createBundle("chrome://devtools/locale/device.properties");
|
|
|
|
/* This is a catalog of common web-enabled devices and their properties,
|
|
* intended for (mobile) device emulation.
|
|
*
|
|
* The properties of a device are:
|
|
* - name: brand and model(s).
|
|
* - width: viewport width.
|
|
* - height: viewport height.
|
|
* - pixelRatio: ratio from viewport to physical screen pixels.
|
|
* - userAgent: UA string of the device's browser.
|
|
* - touch: whether it has a touch screen.
|
|
* - firefoxOS: whether Firefox OS is supported.
|
|
*
|
|
* The device types are:
|
|
* ["phones", "tablets", "laptops", "televisions", "consoles", "watches"].
|
|
*
|
|
* You can easily add more devices to this catalog from your own code (e.g. an
|
|
* addon) like so:
|
|
*
|
|
* var myPhone = { name: "My Phone", ... };
|
|
* require("devtools/client/shared/devices").AddDevice(myPhone, "phones");
|
|
*/
|
|
|
|
// Local devices catalog that addons can add to.
|
|
var localDevices = {};
|
|
|
|
// Add a device to the local catalog.
|
|
function AddDevice(device, type = "phones") {
|
|
let list = localDevices[type];
|
|
if (!list) {
|
|
list = localDevices[type] = [];
|
|
}
|
|
list.push(device);
|
|
}
|
|
exports.AddDevice = AddDevice;
|
|
|
|
// Get the complete devices catalog.
|
|
function GetDevices(bypassCache = false) {
|
|
let deferred = promise.defer();
|
|
|
|
// Fetch common devices from Mozilla's CDN.
|
|
getJSON(DEVICES_URL, bypassCache).then(devices => {
|
|
for (let type in localDevices) {
|
|
if (!devices[type]) {
|
|
devices.TYPES.push(type);
|
|
devices[type] = [];
|
|
}
|
|
devices[type] = localDevices[type].concat(devices[type]);
|
|
}
|
|
deferred.resolve(devices);
|
|
});
|
|
|
|
return deferred.promise;
|
|
}
|
|
exports.GetDevices = GetDevices;
|
|
|
|
// Get the localized string for a device type.
|
|
function GetDeviceString(deviceType) {
|
|
return Strings.GetStringFromName("device." + deviceType);
|
|
}
|
|
exports.GetDeviceString = GetDeviceString;
|