1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-05 16:15:45 +01:00

Move some more message strings to the properties file.

This commit is contained in:
Doug Kearns
2011-03-10 22:06:29 +11:00
parent 0196d116a1
commit 11623d4f8b
10 changed files with 35 additions and 18 deletions

View File

@@ -165,7 +165,7 @@ var Addon = Class("Addon", {
},
commandAllowed: function commandAllowed(cmd) {
util.assert(set.has(actions, cmd), "Unknown command");
util.assert(set.has(actions, cmd), _("addon.unknownCommand"));
let action = actions[cmd];
if ("perm" in action && !(this.permissions & AddonManager["PERM_CAN_" + action.perm.toUpperCase()]))
@@ -176,7 +176,7 @@ var Addon = Class("Addon", {
},
command: function command(cmd) {
util.assert(this.commandAllowed(cmd), "Command not allowed");
util.assert(this.commandAllowed(cmd), _("addon.commandNotAllowed"));
let action = actions[cmd];
if (action.action)

View File

@@ -78,8 +78,8 @@ var Download = Class("Download", {
})),
command: function command(name) {
util.assert(set.has(this.allowedCommands, name), "Unknown command");
util.assert(this.allowedCommands[name], "Command not allowed");
util.assert(set.has(this.allowedCommands, name), _("download.unknownCommand"));
util.assert(this.allowedCommands[name], _("download.commandNotAllowed"));
services.downloadManager[name + "Download"](this.id);
},

View File

@@ -639,7 +639,7 @@ var IO = Module("io", {
if (file.exists() && file.isDirectory() || args[0] && /\/$/.test(args[0]))
file.append(config.name + ".vim");
dactyl.assert(!file.exists() || args.bang, "File exists");
dactyl.assert(!file.exists() || args.bang, _("io.exists"));
let template = util.compileMacro(<![CDATA[
" Vim syntax file
@@ -819,7 +819,7 @@ unlet s:cpo_save
if (modules.options["banghist"]) {
// replaceable bang and no previous command?
dactyl.assert(!/((^|[^\\])(\\\\)*)!/.test(arg) || io._lastRunCommand,
"E34: No previous command");
_("command.run.noPrevious"));
arg = arg.replace(/(\\)*!/g,
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand)

View File

@@ -536,7 +536,7 @@ var Option = Class("Option", {
if (v.length > count)
return prev = parse.call(this, filter, val);
else {
util.assert(prev, "Syntax error", false);
util.assert(prev, _("error.syntaxError"), false);
prev.result += "," + v;
}
}, this))
@@ -592,7 +592,7 @@ var Option = Class("Option", {
let value = parseInt(values);
util.assert(Number(values) % 1 == 0,
"E521: Number required after =: " + this.name + "=" + values);
_("command.set.numberRequired", this.name, values));
switch (operator) {
case "+":
@@ -1044,10 +1044,10 @@ var Options = Module("options", {
}
let opt = modules.options.parseOpt(arg, modifiers);
util.assert(opt, "Error parsing :set command: " + arg);
util.assert(opt, _("command.set.errorParsing", arg));
let option = opt.option;
util.assert(option != null || opt.all, "E518: Unknown option: " + opt.name);
util.assert(option != null || opt.all, _("command.set.unknownOption", opt.name));
// reset a variable to its default value
if (opt.reset) {

View File

@@ -399,7 +399,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
commands.add(["sa[nitize]"],
"Clear private data",
function (args) {
dactyl.assert(!modules.options['private'], "Cannot sanitize items in private mode");
dactyl.assert(!modules.options['private'], _("command.sanitize.privateMode"));
let timespan = args["-timespan"] || modules.options["sanitizetimespan"];
@@ -419,7 +419,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
function (k) modules.options.get("sanitizeitems").has(k));
}
else
dactyl.assert(modules.options.get("sanitizeitems").validator(items), "Valid items required");
dactyl.assert(modules.options.get("sanitizeitems").validator(items), _("error.invalidArgument"));
if (items.indexOf("all") >= 0)
items = Object.keys(sanitizer.itemMap).filter(function (k) items.indexOf(k) === -1);

View File

@@ -556,7 +556,7 @@ var Styles = Module("Styles", {
styles.list(window.content, filter, args["-name"], args.explicitOpts["-group"] ? [args["-group"]] : null);
else {
util.assert(args["-group"].modifiable && args["-group"].hive.modifiable,
"Cannot modify styles in the builtin group");
_("command.style.cantChangeBuiltin"));
if (args["-append"]) {
let sheet = args["-group"].get(args["-name"]);
@@ -642,7 +642,7 @@ var Styles = Module("Styles", {
commands.add(cmd.name, cmd.desc,
function (args) {
dactyl.assert(args.bang ^ !!(args[0] || args[1] || args["-name"] || args["-index"]),
"Argument or ! required");
_("error.argumentOrBang"));
args["-group"].find(args["-name"], args[0], args.literalArg, args["-index"])
.forEach(cmd.action);

View File

@@ -181,12 +181,12 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
// check for chars not in the accepted range
this.assert(RegExp("^[" + accepted + "-]+$").test(list),
"Character list outside the range " + accepted.quote());
_("error.charsOutsideRange", accepted.quote()));
// check for illegal ranges
for (let [match] in this.regexp.iterate(/.-./g, list))
this.assert(match.charCodeAt(0) <= match.charCodeAt(2),
"Invalid character range: " + list.slice(list.indexOf(match)))
_("error.invalidCharRange", list.slice(list.indexOf(match))));
return RegExp("[" + util.regexp.escape(list) + "]");
},