Bug 704838 - help_intro.html and help_man.html contain English text; r=dcamp
authorJoe Walker <jwalker@mozilla.com>
Thu, 08 Dec 2011 12:43:42 +0000
changeset 82266 cf3ed43164811e0ba3e0b1c80073b79ff38e2c97
parent 82265 21c1c224cf9690ad6a91a23598778f48c7b8f412
child 82267 8d91ee82719ce78ac5c65c7be215ea9e35f8d659
push id21589
push usertim.taubert@gmx.de
push dateFri, 09 Dec 2011 04:57:11 +0000
treeherdermozilla-central@9e7239c0f557 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdcamp
bugs704838
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 704838 - help_intro.html and help_man.html contain English text; r=dcamp
browser/devtools/webconsole/gcli.jsm
browser/locales/en-US/chrome/browser/devtools/gcli.properties
--- a/browser/devtools/webconsole/gcli.jsm
+++ b/browser/devtools/webconsole/gcli.jsm
@@ -1490,16 +1490,23 @@ exports.lookup = function(key) {
     return stringBundle.GetStringFromName(key);
   }
   catch (ex) {
     console.error('Failed to lookup ', key, ex);
     return key;
   }
 };
 
+/** @see propertyLookup in lib/gcli/l10n.js */
+exports.propertyLookup = Proxy.create({
+  get: function(rcvr, name) {
+    return exports.lookup(name);
+  }
+});
+
 /** @see lookupFormat in lib/gcli/l10n.js */
 exports.lookupFormat = function(key, swaps) {
   try {
     return stringBundle.formatStringFromName(key, swaps, swaps.length);
   }
   catch (ex) {
     console.error('Failed to format ', key, ex);
     return key;
@@ -5122,17 +5129,17 @@ help.startup = function() {
 
     exec: function(args, context) {
       help.onFirstUseStartup(context.document);
 
       var match = canon.getCommand(args.search);
       if (match) {
         var clone = helpManTemplate.cloneNode(true);
         domtemplate.template(clone, getManTemplateData(match, context),
-                { stack: 'help_man.html' });
+                { allowEval: true, stack: 'help_man.html' });
         return clone;
       }
 
       var parent = util.dom.createElement(context.document, 'div');
       if (!args.search) {
         parent.appendChild(helpIntroTemplate.cloneNode(true));
       }
       parent.appendChild(helpListTemplate.cloneNode(true));
@@ -5195,16 +5202,19 @@ function executeCommand(element, context
   });
 }
 
 /**
  * Create a block of data suitable to be passed to the help_list.html template
  */
 function getListTemplateData(args, context) {
   return {
+    l10n: l10n.propertyLookup,
+    lang: context.document.defaultView.navigator.language,
+
     onclick: function(ev) {
       updateCommand(ev.currentTarget, context);
     },
 
     ondblclick: function(ev) {
       executeCommand(ev.currentTarget, context);
     },
 
@@ -5232,16 +5242,19 @@ function getListTemplateData(args, conte
   };
 }
 
 /**
  * Create a block of data suitable to be passed to the help_man.html template
  */
 function getManTemplateData(command, context) {
   return {
+    l10n: l10n.propertyLookup,
+    lang: context.document.defaultView.navigator.language,
+
     command: command,
 
     onclick: function(ev) {
       updateCommand(ev.currentTarget, context);
     },
 
     getTypeDescription: function(param) {
       var input = '';
@@ -5270,25 +5283,22 @@ define('gcli/ui/domtemplate', ['require'
 
   var obj = {};
   Components.utils.import('resource:///modules/devtools/Templater.jsm', obj);
   exports.template = obj.template;
 
 });
 define("text!gcli/commands/help.css", [], void 0);
 define("text!gcli/commands/help_intro.html", [], "\n" +
-  "<h2>Welcome to GCLI</h2>\n" +
-  "\n" +
-  "<p>GCLI is an experiment to create a highly usable JavaScript command line for developers.</p>\n" +
+  "<h2>${l10n.introHeader}</h2>\n" +
   "\n" +
   "<p>\n" +
-  "  Useful links:\n" +
-  "  <a target='_blank' href='https://github.com/joewalker/gcli'>source</a> (BSD),\n" +
-  "  <a target='_blank' href='https://github.com/joewalker/gcli/blob/master/docs/index.md'>documentation</a> (for users/embedders),\n" +
-  "  <a target='_blank' href='https://wiki.mozilla.org/DevTools/Features/GCLI'>Mozilla feature page</a> (for GCLI in the web console).\n" +
+  "  <a target=\"_blank\" href=\"https://developer.mozilla.org/AppLinks/WebConsoleHelp?locale=${lang}\">\n" +
+  "    ${l10n.introBody}\n" +
+  "  </a>\n" +
   "</p>\n" +
   "");
 
 define("text!gcli/commands/help_list.html", [], "\n" +
   "<h3>${getHeading()}</h3>\n" +
   "\n" +
   "<table>\n" +
   "  <tr foreach=\"command in ${getMatchingCommands()}\"\n" +
@@ -5302,35 +5312,35 @@ define("text!gcli/commands/help_list.htm
   "  </tr>\n" +
   "</table>\n" +
   "");
 
 define("text!gcli/commands/help_man.html", [], "\n" +
   "<h3>${command.name}</h3>\n" +
   "\n" +
   "<h4 class=\"gcli-help-header\">\n" +
-  "  Synopsis:\n" +
+  "  ${l10n.helpManSynopsis}:\n" +
   "  <span class=\"gcli-help-synopsis\" onclick=\"${onclick}\">\n" +
   "    <span class=\"gcli-help-command\">${command.name}</span>\n" +
   "    <span foreach=\"param in ${command.params}\">\n" +
   "      ${param.defaultValue !== undefined ? '[' + param.name + ']' : param.name}\n" +
   "    </span>\n" +
   "  </span>\n" +
   "</h4>\n" +
   "\n" +
-  "<h4 class=\"gcli-help-header\">Description:</h4>\n" +
+  "<h4 class=\"gcli-help-header\">${l10n.helpManDescription}:</h4>\n" +
   "\n" +
   "<p class=\"gcli-help-description\">\n" +
   "  ${command.manual || command.description}\n" +
   "</p>\n" +
   "\n" +
-  "<h4 class=\"gcli-help-header\">Parameters:</h4>\n" +
+  "<h4 class=\"gcli-help-header\">${l10n.helpManParameters}:</h4>\n" +
   "\n" +
   "<ul class=\"gcli-help-parameter\">\n" +
-  "  <li if=\"${command.params.length === 0}\">None</li>\n" +
+  "  <li if=\"${command.params.length === 0}\">${l10n.helpManNone}</li>\n" +
   "  <li foreach=\"param in ${command.params}\">\n" +
   "    <tt>${param.name}</tt> ${getTypeDescription(param)}\n" +
   "    <br/>\n" +
   "    ${param.manual || param.description}\n" +
   "  </li>\n" +
   "</ul>\n" +
   "");
 
--- a/browser/locales/en-US/chrome/browser/devtools/gcli.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/gcli.properties
@@ -110,8 +110,34 @@ helpManual=Provide help either on a spec
 # with restricted space, which is why it should be as short as possible.
 helpSearchDesc=Search string
 
 # LOCALIZATION NOTE (helpSearchManual): A fuller description of the 'search'
 # parameter to the 'help' command. Displayed when the user asks for help on
 # what it does.
 helpSearchManual=A search string to use in narrowing down the list of commands that are displayed to the user. Any part of the string can match, regular expressions are not supported.
 
+# LOCALIZATION NOTE (helpManSynopsis): A heading shown at the top of a help
+# page for a command in the console It labels a summary of the parameters to
+# the command
+helpManSynopsis=Synopsis
+
+# LOCALIZATION NOTE (helpManDescription): A heading shown in a help page for a
+# command in the console. This heading precedes the top level description.
+helpManDescription=Description
+
+# LOCALIZATION NOTE (helpManParameters): A heading shown above the parameters
+# in a help page for a command in the console.
+helpManParameters=Parameters
+
+# LOCALIZATION NOTE (helpManNone): Some text shown under the parameters
+# heading in a help page for a command which has no parameters.
+helpManNone=None
+
+# LOCALIZATION NOTE (introHeader): The heading displayed at the top of the
+# output for the help command
+introHeader=Welcome to Firefox Developer Tools
+
+# LOCALIZATION NOTE (introBody): The text displayed at the top of the output
+# for the help command, just before the list of commands. This text is wrapped
+# inside a link to a localized MDN article
+introBody=For more information see MDN.
+