diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/content/dactyl.js | 2 | ||||
-rw-r--r-- | common/locale/en-US/messages.properties | 33 | ||||
-rw-r--r-- | common/modules/addons.jsm | 6 | ||||
-rw-r--r-- | common/modules/commands.jsm | 12 | ||||
-rw-r--r-- | common/modules/finder.jsm | 10 | ||||
-rw-r--r-- | common/modules/io.jsm | 17 | ||||
-rw-r--r-- | common/modules/options.jsm | 18 | ||||
-rw-r--r-- | common/modules/prefs.jsm | 6 | ||||
-rw-r--r-- | common/modules/sanitizer.jsm | 9 | ||||
-rw-r--r-- | common/modules/styles.jsm | 2 |
10 files changed, 73 insertions, 42 deletions
diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 45302e7a..dae302d9 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -475,7 +475,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { let res = true; for (let [command, args] in commands.parseCommands(str.replace(/^'(.*)'$/, "$1"))) { if (command === null) - throw FailedAssertion("E492: Not a " + config.appName + " command: " + args.commandString); + throw FailedAssertion(_("dactyl.notCommand", config.appName, args.commandString)); res = res && command.execute(args, modifiers); } diff --git a/common/locale/en-US/messages.properties b/common/locale/en-US/messages.properties index 1c8ecc01..bf531e3e 100644 --- a/common/locale/en-US/messages.properties +++ b/common/locale/en-US/messages.properties @@ -1,6 +1,12 @@ +# TODO: normalise this debacle of Vim legacy messages +# : are we losing the error code prefixes? --djk + abbrev.noSuch = No such abbreviation abbrev.none = No abbreviations found +addon.check-1 = Checking updates for addons: %S +addon.cantInstallDir-1 = Cannot install a directory: %S + autocmd.executing-2 = Executing %S Auto commands for %S autocmd.autocommand-1 = autocommand %S autocmd.noMatching = No matching autocommands @@ -36,12 +42,24 @@ command.invalidOpt-1 = Invalid option: %S command.invalidOptArg-2 = Invalid argument for option %S: %S command.invalidOptTypeArg-3 = Invalid argument for %S option %S: %S command.parsing-1 = Error parsing arguments: %S +command.none = No user-defined commands found +command.unknownCompleter-1 = E117: Unknown function: %S +command.exists = E174: Command already exists: add ! to replace it +command.noPrevious = E30: No previous command line +command.noRange = E481: No range allowed +command.noRange = E477: No ! allowed command.colorscheme.notFound = E185: Cannot find color scheme %S command.conditional.illegal = Invalid use of conditional command.finish.illegal = E168: :finish used outside of a sourced file +commmand.let.noSuch-1 = E108: No such variable: %S +command.let.unexpectedChar = E18: Unexpected characters in :let +command.let.illegalVar-1 = E461: Illegal variable name: %S +command.let.undefinedVar-1 = E121: Undefined variable: %S +command.let.invalidExpression-1 = E15: Invalid expression: %S dactyl.parsingCommandLine-1 = Parsing command line options: %S +dactyl.notCommand-2 = E492: Not a %S command: %S dialog.notAvailable-1 = Dialog %S not available @@ -59,6 +77,10 @@ emenu.notFound-1 = Menu not found: %S event.error-2 = Processing %S event: %S event.nothingToPass = No events to pass +finder.notFound-1 = E486: Pattern not found: %S +finder.atTop = find hit TOP, continuing at BOTTOM +finder.atBottom = find hit BOTTOM, continuing at TOP + help.dontPanic = E478: Don't panic! help.noFile-1 = Sorry, help file %S not found help.noTopic-1 = Sorry, no help for %S @@ -72,8 +94,12 @@ history.noURL = URL not found in history io.noSuchDir = E344: Can't find directory %S io.noPrevDir = E186: No previous directory io.notReadable-1 = Can't open file %S -io.notWriteable-1 = %S: Can't open file for writing +io.notWriteable-1 = Can't open file %S for writing io.exists = File exists (add ! to override) +io.exists-1 = File %S exists (add ! to override) +io.noCommand-1 = Command not found: %S +io.commandFailed = E472: Command failed +io.oneFileAllowed = E172: Only one file name allowed macro.canceled-1 = Canceled playback of macro '%S' macro.recorded-1 = Recorded macro '%S' @@ -115,8 +141,12 @@ save.invalidDestination-1 = Invalid destination: %S status.link-1 = Link: %S +style.none = No mapping found + time.total = Total time: %S +variable.none = No variables found + window.cantAttachSame = Can't reattach to the same window window.noIndex-1 = Window %S does not exist @@ -131,6 +161,7 @@ error.invalidSort-1 = Invalid sort order: %S error.argRequired = Argument required error.trailing = Trailing characters +error.trailing-1 = Trailing characters: %S error.invalid-1 = Invalid %S error.invalidArgument = Invalid argument error.invalidArgument-1 = Invalid argument: %S diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 8909eee3..03c4e0fb 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -53,7 +53,7 @@ var updateAddons = Class("UpgradeListener", AddonListener, { this.remaining = addons; this.upgrade = []; - this.dactyl.echomsg("Checking updates for addons: " + addons.map(function (a) a.name).join(", ")); + this.dactyl.echomsg(_("addon.check", addons.map(function (a) a.name).join(", "))); for (let addon in values(addons)) addon.findUpdates(this, AddonManager.UPDATE_WHEN_USER_REQUESTED, null, null); @@ -391,9 +391,9 @@ var Addons = Module("addons", { else if (file.isReadable() && file.isFile()) AddonManager.getInstallForFile(file, install, "application/x-xpinstall"); else if (file.isDirectory()) - dactyl.echoerr("Cannot install a directory: " + file.path.quote()); + dactyl.echoerr(_("addon.cantInstallDir", file.path.quote())); else - dactyl.echoerr("E484: Can't open file " + file.path); + dactyl.echoerr(_("io.notReadable-1", file.path)); }, { argCount: "1", completer: function (context) { diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index cc989bf5..446d9ad5 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -164,9 +164,9 @@ var Command = Class("Command", { modifiers = modifiers || {}; if (args.count != null && !this.count) - throw FailedAssertion("E481: No range allowed"); + throw FailedAssertion(_("command.noRange")); if (args.bang && !this.bang) - throw FailedAssertion("E477: No ! allowed"); + throw FailedAssertion(_("command.noBang")); return !dactyl.trapErrors(function exec() { let extra = this.hive.argsExtra(args); @@ -635,7 +635,7 @@ var Commands = Module("commands", { } if (!this.userHives.some(function (h) h._list.length)) - dactyl.echomsg("No user-defined commands found"); + dactyl.echomsg(_("command.none")); else commandline.commandOutput( <table> @@ -1396,7 +1396,7 @@ var Commands = Module("commands", { } catch (e) { dactyl.echo(":" + this.name + " ..."); - dactyl.echoerr("E117: Unknown function: " + completer); + dactyl.echoerr(_("command.unknownCompleter", completer)); dactyl.log(e); return undefined; } @@ -1433,7 +1433,7 @@ var Commands = Module("commands", { }, args.bang); if (!added) - dactyl.echoerr("E174: Command already exists: add ! to replace it"); + dactyl.echoerr(_("command.exists")); } }, { bang: true, @@ -1598,7 +1598,7 @@ var Commands = Module("commands", { dactyl.execute(commands.repeat); } else - dactyl.echoerr("E30: No previous command line"); + dactyl.echoerr(_("command.noPrevious")); }, { count: true }); } diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm index 0a4dc973..5edd5904 100644 --- a/common/modules/finder.jsm +++ b/common/modules/finder.jsm @@ -7,7 +7,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("finder", { exports: ["RangeFind", "RangeFinder", "rangefinder"], - use: ["services", "util"] + use: ["messages", "services", "util"] }, this); function equals(a, b) XPCNativeWrapper(a) == XPCNativeWrapper(b); @@ -93,7 +93,7 @@ var RangeFinder = Module("rangefinder", { find: function (pattern, backwards) { let str = this.bootstrap(pattern, backwards); if (!this.rangeFind.find(str)) - this.dactyl.echoerr("E486: Pattern not found: " + pattern, + this.dactyl.echoerr(_("finder.notFound", pattern), this.commandline.FORCE_SINGLELINE); return this.rangeFind.found; @@ -103,11 +103,11 @@ var RangeFinder = Module("rangefinder", { if (!this.rangeFind) this.find(this.lastFindPattern); else if (!this.rangeFind.find(null, reverse)) - this.dactyl.echoerr("E486: Pattern not found: " + this.lastFindPattern, + this.dactyl.echoerr(_("finder.notFound", this.lastFindPattern), this.commandline.FORCE_SINGLELINE); else if (this.rangeFind.wrapped) { - let msg = this.rangeFind.backward ? "find hit TOP, continuing at BOTTOM" - : "find hit BOTTOM, continuing at TOP"; + let msg = this.rangeFind.backward ? _("finder.atTop") + : _("finder.atBottom"); this.commandline.echo(msg, "WarningMsg", this.commandline.APPEND_TO_MESSAGES | this.commandline.FORCE_SINGLELINE); } diff --git a/common/modules/io.jsm b/common/modules/io.jsm index e56511dc..cd2e8597 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -158,7 +158,7 @@ var IO = Module("io", { if (!file.exists() || !file.isReadable() || file.isDirectory()) { if (!params.silent) - dactyl.echoerr("E484: Can't open file " + filename.quote()); + dactyl.echoerr(_("io.notReadable", filename.quote())); return; } @@ -430,7 +430,7 @@ var IO = Module("io", { let file = this.pathSearch(program); if (!file || !file.exists()) { - util.dactyl.echoerr("Command not found: " + program); + util.dactyl.echoerr(_("io.noCommand", program)); if (callable(blocking)) util.trapErrors(blocking); return -1; @@ -586,8 +586,8 @@ var IO = Module("io", { } } - dactyl.echoerr("E344: Can't find directory " + arg.quote() + " in cdpath"); - dactyl.echoerr("E472: Command failed"); + dactyl.echoerr(_("io.noSuchDir", arg.quote())); + dactyl.echoerr(_("io.commandFailed")); } }, { argCount: "?", @@ -603,12 +603,11 @@ var IO = Module("io", { commands.add([config.name.replace(/(.)(.*)/, "mk$1[$2rc]")], "Write current key mappings and changed options to the config file", function (args) { - dactyl.assert(args.length <= 1, "E172: Only one file name allowed"); + dactyl.assert(args.length <= 1, _("io.oneFileAllowed")); let file = io.File(args[0] || io.getRCFile(null, true)); - dactyl.assert(!file.exists() || args.bang, - "E189: " + file.path.quote() + " exists (add ! to override)"); + dactyl.assert(!file.exists() || args.bang, _("io.exists", file.path.quote())); // TODO: Use a set/specifiable list here: let lines = [cmd.serialize().map(commands.commandToString, cmd) for (cmd in commands.iterator(true)) if (cmd.serialize)]; @@ -621,7 +620,7 @@ var IO = Module("io", { file.write(lines.join("\n")); } catch (e) { - dactyl.echoerr("E190: Cannot open " + file.path.quote() + " for writing"); + dactyl.echoerr(_("io.notWriteable"), file.path.quote()); dactyl.log("Could not write to " + file.path + ": " + e.message); // XXX } }, { @@ -793,7 +792,7 @@ unlet s:cpo_save "Read Ex commands from a file", function (args) { if (args.length > 1) - dactyl.echoerr("E172: Only one file name allowed"); + dactyl.echoerr(_("io.oneFileAllowed")); else io.source(args[0], { silent: args.bang }); }, { diff --git a/common/modules/options.jsm b/common/modules/options.jsm index 2e2d2c3c..ba662815 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -237,8 +237,8 @@ var Option = Class("Option", { */ isValidValue: function isValidValue(values) this.validator(values), - invalidArgument: function invalidArgument(arg, op) "E474: Invalid argument: " + - this.name + (op || "").replace(/=?$/, "=") + arg, + invalidArgument: function invalidArgument(arg, op) _("error.invalidArgument", + this.name + (op || "").replace(/=?$/, "=") + arg), /** * Resets the option to its default value. @@ -1066,7 +1066,7 @@ var Options = Module("options", { else { flushList(); if (opt.option.type === "boolean") { - util.assert(!opt.valueGiven, "E474: Invalid argument: " + arg); + util.assert(!opt.valueGiven, _("error.invalidArgument", arg)); opt.values = !opt.unsetBoolean; } else if (/^(string|number)$/.test(opt.option.type) && opt.invert) @@ -1192,7 +1192,7 @@ var Options = Module("options", { } </table>; if (str.text().length() == str.*.length()) - dactyl.echomsg("No variables found"); + dactyl.echomsg(_("variable.none")); else dactyl.echo(str, commandline.FORCE_MULTILINE); return; @@ -1204,9 +1204,9 @@ var Options = Module("options", { let fullName = (scope || "") + name; util.assert(scope == "g:" || scope == null, - "E461: Illegal variable name: " + scope + name); + _("command.let.illegalVar", scope + name)); util.assert(set.has(globalVariables, name) || (expr && !op), - "E121: Undefined variable: " + fullName); + _("command.let.undefinedVar", fullName)); if (!expr) dactyl.echo(fullName + "\t\t" + fmt(globalVariables[name])); @@ -1216,7 +1216,7 @@ var Options = Module("options", { } catch (e) {} util.assert(newValue !== undefined, - "E15: Invalid expression: " + expr); + _("command.let.invalidExpression", expr)); let value = newValue; if (op) { @@ -1232,7 +1232,7 @@ var Options = Module("options", { } } else - dactyl.echoerr("E18: Unexpected characters in :let"); + dactyl.echoerr(_("command.let.unexpectedChar")); }, { deprecated: "the options system", @@ -1305,7 +1305,7 @@ var Options = Module("options", { name = name.replace(/^g:/, ""); // throw away the scope prefix if (!set.has(dactyl._globalVariables, name)) { if (!args.bang) - dactyl.echoerr("E108: No such variable: " + name); + dactyl.echoerr(_("command.let.noSuch", name)); return; } diff --git a/common/modules/prefs.jsm b/common/modules/prefs.jsm index 38c26ed0..af84c0f5 100644 --- a/common/modules/prefs.jsm +++ b/common/modules/prefs.jsm @@ -12,7 +12,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("prefs", { exports: ["Prefs", "localPrefs", "prefs"], require: ["services", "util"], - use: ["config", "template"] + use: ["config", "messages", "template"] }, this); var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), { @@ -221,7 +221,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) util.assert(type === Ci.nsIPrefBranch.PREF_INVALID || type === needType, type === Ci.nsIPrefBranch.PREF_INT ? "E521: Number required after =: " + name + "=" + value - : "E474: Invalid argument: " + name + "=" + value); + : _("error.invalidArgument", name + "=" + value)); let type = this.branch.getPrefType(name); switch (typeof value) { @@ -289,7 +289,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) */ toggle: function (name) { util.assert(this.branch.getPrefType(name) === Ci.nsIPrefBranch.PREF_BOOL, - "E488: Trailing characters: " + name + "!"); + _("error.trailing", name + "!")); this.set(name, !this.get(name)); }, diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index 213f63da..9ba58517 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -17,7 +17,8 @@ try { Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("sanitizer", { exports: ["Range", "Sanitizer", "sanitizer"], - require: ["prefs", "services", "storage", "template", "util"] + require: ["prefs", "services", "storage", "template", "util"], + use: ["messages"] }, this); let tmp = {}; @@ -389,7 +390,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef }, window); }, commands: function (dactyl, modules, window) { - const commands = modules.commands; + const { commands } = modules; commands.add(["sa[nitize]"], "Clear private data", function (args) { @@ -408,7 +409,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef args[0] = "all"; if (args.bang) { - dactyl.assert(args.length == 0, "E488: Trailing characters"); + dactyl.assert(args.length == 0, _("error.trailing")); items = Object.keys(sanitizer.itemMap).filter( function (k) modules.options.get("sanitizeitems").has(k)); } @@ -509,7 +510,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef for (c in Sanitizer.iterCookies(host))))); return; default: - util.assert(cmd in Sanitizer.PERMS, "Invalid argument"); + util.assert(cmd in Sanitizer.PERMS, _("error.invalidArgument")); setPerms(host, cmd); } }, { diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm index 2a716025..259d4560 100644 --- a/common/modules/styles.jsm +++ b/common/modules/styles.jsm @@ -337,7 +337,7 @@ var Styles = Module("Styles", { // TODO: Move this to an ItemList to show this automatically if (list.*.length() === list.text().length() + 2) - dactyl.echomsg("No mapping found"); + dactyl.echomsg(_("style.none")); else commandline.commandOutput(list); }, |