1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-04 08:55:47 +01:00

Allow localization of command/mapping/option descriptions.

This commit is contained in:
Kris Maglione
2011-03-04 20:37:29 -05:00
parent f3c14e861c
commit 058094f87d
8 changed files with 139 additions and 78 deletions

View File

@@ -11,8 +11,8 @@ try {
Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("commands", {
exports: ["ArgType", "Command", "Commands", "CommandOption", "Ex", "commands"],
require: ["contexts", "util"],
use: ["config", "messages", "options", "services", "template"]
require: ["contexts", "messages", "util"],
use: ["config", "options", "services", "template"]
}, this);
/**
@@ -132,10 +132,14 @@ var Command = Class("Command", {
update(this, extraInfo);
if (this.options)
this.options = this.options.map(CommandOption.fromArray, CommandOption);
for each (let option in this.options)
option.localeName = ["command", this.name, option.names[0]];
},
get toStringParams() [this.name, this.hive.name],
get identifier() this.hive.prefix + this.name,
get helpTag() ":" + this.name,
get lastCommand() this._lastCommand || commandline.command,
@@ -224,7 +228,7 @@ var Command = Class("Command", {
names: null,
/** @property {string} This command's description, as shown in :listcommands */
description: "",
description: Messages.Localized(""),
/**
* @property {function (Args)} The function called to execute this command.
*/
@@ -1078,7 +1082,10 @@ var Commands = Module("commands", {
context.completions = compl;
}
complete.advance(args.completeStart);
complete.keys = { text: "names", description: "description" };
complete.keys = {
text: "names",
description: function (opt) messages.get(["command", params.name, opt.names[0], "description"].join("."), opt.description)
};
complete.title = ["Options"];
if (completeOpts)
complete.completions = completeOpts;