Bug 1386616 - dt-addon: move key-shortcuts.properties to devtools/shim/locales;r=ochameau draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 02 Aug 2017 16:20:58 +0200
changeset 644962 806a6baa5886fbad2b50df80a7560b5300bd25b5
parent 644961 1a8239167f5bfc98a170907e1337ac19b27e0799
child 725761 7d555f841dd9a1585ec206883b7d4c33dcfac60f
push id73602
push userjdescottes@mozilla.com
push dateFri, 11 Aug 2017 15:54:39 +0000
reviewersochameau
bugs1386616
milestone57.0a1
Bug 1386616 - dt-addon: move key-shortcuts.properties to devtools/shim/locales;r=ochameau MozReview-Commit-ID: 9zUqnuYIdWS
devtools/client/definitions.js
devtools/client/locales/en-US/key-shortcuts.properties
devtools/shared/Loader.jsm
devtools/shared/l10n.js
devtools/shim/devtools-startup.js
devtools/shim/locales/en-US/key-shortcuts.properties
--- a/devtools/client/definitions.js
+++ b/devtools/client/definitions.js
@@ -28,17 +28,17 @@ loader.lazyGetter(this, "DomPanel", () =
 loader.lazyRequireGetter(this, "CommandUtils", "devtools/client/shared/developer-toolbar", true);
 loader.lazyRequireGetter(this, "CommandState", "devtools/shared/gcli/command-state", true);
 loader.lazyImporter(this, "ResponsiveUIManager", "resource://devtools/client/responsivedesign/responsivedesign.jsm");
 loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scratchpad/scratchpad-manager.jsm");
 
 const {MultiLocalizationHelper} = require("devtools/shared/l10n");
 const L10N = new MultiLocalizationHelper(
   "devtools/client/locales/startup.properties",
-  "devtools/client/locales/key-shortcuts.properties"
+  "devtools/shim/locales/key-shortcuts.properties"
 );
 
 var Tools = {};
 exports.Tools = Tools;
 
 // Definitions
 Tools.options = {
   id: "options",
--- a/devtools/shared/Loader.jsm
+++ b/devtools/shared/Loader.jsm
@@ -51,16 +51,17 @@ BuiltinProvider.prototype = {
       // Allow access to xpcshell test items from the loader.
       "xpcshell-test": "resource://test",
 
       // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
       // Allow access to locale data using paths closer to what is
       // used in the source tree.
       "devtools/client/locales": "chrome://devtools/locale",
       "devtools/shared/locales": "chrome://devtools-shared/locale",
+      "devtools/shim/locales": "chrome://devtools-shim/locale",
       "toolkit/locales": "chrome://global/locale",
     };
     // When creating a Loader invisible to the Debugger, we have to ensure
     // using only modules and not depend on any JSM. As everything that is
     // not loaded with Loader isn't going to respect `invisibleToDebugger`.
     // But we have to keep using Promise.jsm for other loader to prevent
     // breaking unhandled promise rejection in tests.
     if (this.invisibleToDebugger) {
--- a/devtools/shared/l10n.js
+++ b/devtools/shared/l10n.js
@@ -25,16 +25,18 @@ const propertiesMap = {};
 // directory.  Then we use the correct context to load the property
 // file.  In the webpack case this results in just the locale property
 // files being included in the pack; and in the devtools case this is
 // a wordy no-op.
 const reqShared = require.context("raw!devtools/shared/locales/",
                                   true, /^.*\.properties$/);
 const reqClient = require.context("raw!devtools/client/locales/",
                                   true, /^.*\.properties$/);
+const reqShim = require.context("raw!devtools/shim/locales/",
+                                  true, /^.*\.properties$/);
 const reqGlobal = require.context("raw!toolkit/locales/",
                                   true, /^.*\.properties$/);
 
 /**
  * Memoized getter for properties files that ensures a given url is only required and
  * parsed once.
  *
  * @param {String} url
@@ -51,16 +53,18 @@ function getProperties(url) {
     let index = url.lastIndexOf("/");
     // Turn "mumble/locales/resource.properties" => "./resource.properties".
     let baseName = "." + url.substr(index);
     let reqFn;
     if (/^toolkit/.test(url)) {
       reqFn = reqGlobal;
     } else if (/^devtools\/shared/.test(url)) {
       reqFn = reqShared;
+    } else if (/^devtools\/shim/.test(url)) {
+      reqFn = reqShim;
     } else {
       reqFn = reqClient;
     }
     propertiesMap[url] = parsePropertiesFile(reqFn(baseName));
   }
 
   return propertiesMap[url];
 }
--- a/devtools/shim/devtools-startup.js
+++ b/devtools/shim/devtools-startup.js
@@ -37,17 +37,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
                                   "resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
                                   "resource:///modules/CustomizableUI.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableWidgets",
                                   "resource:///modules/CustomizableWidgets.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "Bundle", function () {
-  const kUrl = "chrome://devtools/locale/key-shortcuts.properties";
+  const kUrl = "chrome://devtools-shim/locale/key-shortcuts.properties";
   return Services.strings.createBundle(kUrl);
 });
 
 XPCOMUtils.defineLazyGetter(this, "KeyShortcuts", function () {
   const isMac = AppConstants.platform == "macosx";
 
   // Common modifier shared by most key shortcuts
   const modifiers = isMac ? "accel,alt" : "accel,shift";
rename from devtools/client/locales/en-US/key-shortcuts.properties
rename to devtools/shim/locales/en-US/key-shortcuts.properties