diff --git a/common/content/events.js b/common/content/events.js index 14c25615..0a836a33 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -539,7 +539,7 @@ var Events = Module("events", { timeRecorded: Date.now() }); - dactyl.log("Recorded " + this.recording + ": " + this._macroKeys.join(""), 9); + dactyl.log(_("macro.recorded", this.recording, this._macroKeys.join("")), 9); dactyl.echomsg(_("macro.recorded", this.recording)); } this._recording = macro || null; diff --git a/common/content/marks.js b/common/content/marks.js index aedbfc06..c5a3ef04 100644 --- a/common/content/marks.js +++ b/common/content/marks.js @@ -53,14 +53,14 @@ var Marks = Module("marks", { if (Marks.isURLMark(mark)) { let res = this._urlMarks.set(mark, { location: doc.documentURI, position: position, tab: Cu.getWeakReference(tabs.getTab()), timestamp: Date.now()*1000 }); if (!silent) - dactyl.log("Adding URL mark: " + Marks.markToString(mark, res), 5); + dactyl.log(_("mark.addURL", Marks.markToString(mark, res)), 5); } else if (Marks.isLocalMark(mark)) { let marks = this._localMarks.get(doc.documentURI, {}); marks[mark] = { location: doc.documentURI, position: position, timestamp: Date.now()*1000 }; this._localMarks.changed(); if (!silent) - dactyl.log("Adding local mark: " + Marks.markToString(mark, marks[mark]), 5); + dactyl.log(_("mark.addLocal", Marks.markToString(mark, marks[mark])), 5); } }, @@ -115,7 +115,7 @@ var Marks = Module("marks", { tabs.select(tab); let doc = tab.linkedBrowser.contentDocument; if (doc.documentURI == mark.location) { - dactyl.log("Jumping to URL mark: " + Marks.markToString(char, mark), 5); + dactyl.log(_("mark.jumpingToURL", Marks.markToString(char, mark)), 5); buffer.scrollToPercent(mark.position.x * 100, mark.position.y * 100); } else { @@ -146,7 +146,7 @@ var Marks = Module("marks", { let mark = (this._localMarks.get(this.localURI) || {})[char]; dactyl.assert(mark, _("mark.unset", char)); - dactyl.log("Jumping to local mark: " + Marks.markToString(char, mark), 5); + dactyl.log(_("marks.jumpingToLocal", Marks.markToString(char, mark)), 5); buffer.scrollToPercent(mark.position.x * 100, mark.position.y * 100); } else diff --git a/common/locale/en-US/messages.properties b/common/locale/en-US/messages.properties index f76e89ee..45532960 100644 --- a/common/locale/en-US/messages.properties +++ b/common/locale/en-US/messages.properties @@ -81,6 +81,7 @@ dactyl.modulesLoaded = All modules loaded dactyl.commandlineOpts-1 = Command-line options: %S dactyl.noRCFile = No user RC file found dactyl.initialized-1 = %S fully initialized +dactyl.sourced-1 = Sourced: %S dialog.notAvailable-1 = Dialog %S not available @@ -135,6 +136,7 @@ io.downloadFinished-2 = Download of %S to %S finished macro.canceled-1 = Canceled playback of macro '%S' macro.recorded-1 = Recorded macro '%S' +macro.recorded-2 = Recorded macro %S: %S macro.loadFailed-1 = Page did not load completely in %S seconds macro.loadWaiting = Waiting for page to load... macro.noSuch-1 = Macro '%S' not set @@ -150,6 +152,11 @@ mark.none = No marks set mark.invalid = Invalid mark mark.unset-1 = Mark not set: %S mark.noMatching-1 = E283: No marks matching %S +# TODO: relies on mark formatter +mark.addURL-1 = Adding URL mark: %S +mark.addLocal-1 = Adding local mark: %S +mark.jumpingToURL-1 = Jumping to URL mark: %S +mark.jumpingToLocal-1 = Jumping to local mark: %S mode.recursiveSet = Not executing modes.set recursively mode.invalidBases = Invalid bases @@ -210,6 +217,7 @@ error.nullComputedStyle-1 = Computed style is null: %S error.syntaxError = Syntax error error.charsOutsideRange-1 = Character list outside the range %S error.invalidCharRange = Invalid character range: %S +error.notWriteable-1 = Could not write to %S: %S warn.notDefaultBranch-2 = You are running %S from a testing branch: %S. Please do not report errors which do not also occur in the default branch. diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 64c932d0..145d885e 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -1399,7 +1399,7 @@ var Commands = Module("commands", { }); } catch (e) { - dactyl.echo(":" + this.name + " ..."); + dactyl.echo(":" + this.name + " ..."); // XXX dactyl.echoerr(_("command.unknownCompleter", completer)); dactyl.log(e); return undefined; diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 7c4c4e6c..014cb989 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -13,7 +13,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("config", { exports: ["ConfigBase", "Config", "config"], require: ["services", "storage", "util", "template"], - use: ["io", "prefs"] + use: ["io", "messages", "prefs"] }, this); var ConfigBase = Class("ConfigBase", { diff --git a/common/modules/io.jsm b/common/modules/io.jsm index 0d7223b9..57a32857 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -202,8 +202,8 @@ var IO = Module("io", { this._scriptNames.push(file.path); dactyl.echomsg(_("io.sourcingEnd", filename.quote()), 2); + dactyl.log(_("dactyl.sourced", filename), 3); - dactyl.log("Sourced: " + filename, 3); return context; } catch (e) { @@ -622,7 +622,7 @@ var IO = Module("io", { } catch (e) { dactyl.echoerr(_("io.notWriteable"), file.path.quote()); - dactyl.log("Could not write to " + file.path + ": " + e.message); // XXX + dactyl.log(_("error.notWriteable", file.path, e.message)); // XXX } }, { argCount: "*", // FIXME: should be "?" but kludged for proper error message diff --git a/common/modules/util.jsm b/common/modules/util.jsm index f56ce948..df4dca63 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -13,7 +13,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("util", { exports: ["frag", "FailedAssertion", "Math", "NS", "Point", "Util", "XBL", "XHTML", "XUL", "util"], require: ["services"], - use: ["commands", "config", "highlight", "storage", "template"] + use: ["commands", "config", "highlight", "messages", "storage", "template"] }, this); var XBL = Namespace("xbl", "http://www.mozilla.org/xbl"); @@ -827,7 +827,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), return xmlhttp; } catch (e) { - util.dactyl.log("Error opening " + String.quote(url) + ": " + e, 1); + util.dactyl.log(_("error.cantOpen", String.quote(url), e), 1); return null; } }, diff --git a/melodactyl/content/player.js b/melodactyl/content/player.js index 8eb8f117..3bed2ed0 100644 --- a/melodactyl/content/player.js +++ b/melodactyl/content/player.js @@ -44,34 +44,35 @@ const Player = Module("player", { onMediacoreEvent: function (event) { switch (event.type) { case Ci.sbIMediacoreEvent.BEFORE_TRACK_CHANGE: - dactyl.log("Before track changed: " + event.data); + dactyl.log(_("player.preTrackChange", event.data)); autocommands.trigger("TrackChangePre", { track: event.data }); break; case Ci.sbIMediacoreEvent.TRACK_CHANGE: + dactyl.log(_("player.trackChanged", event.data)); autocommands.trigger("TrackChange", { track: event.data }); break; case Ci.sbIMediacoreEvent.BEFORE_VIEW_CHANGE: - dactyl.log("Before view changed: " + event.data); + dactyl.log(_("player.preViewChange", event.data)); autocommands.trigger("ViewChangePre", { view: event.data }); break; case Ci.sbIMediacoreEvent.VIEW_CHANGE: - dactyl.log("View changed: " + event.data); + dactyl.log(_("player.viewChange", event.data)); autocommands.trigger("ViewChange", { view: event.data }); break; case Ci.sbIMediacoreEvent.STREAM_START: - dactyl.log("Track started: " + gMM.sequencer.currentItem); + dactyl.log(_("player.trackStart", gMM.sequencer.currentItem)); autocommands.trigger("StreamStart", { track: gMM.sequencer.currentItem }); break; case Ci.sbIMediacoreEvent.STREAM_PAUSE: - dactyl.log("Track paused: " + gMM.sequencer.currentItem); + dactyl.log(_("player.trackPause", gMM.sequencer.currentItem)); autocommands.trigger("StreamPause", { track: gMM.sequencer.currentItem }); break; case Ci.sbIMediacoreEvent.STREAM_END: - dactyl.log("Track ended: " + gMM.sequencer.currentItem); + dactyl.log(_("player.trackEnd", gMM.sequencer.currentItem)); autocommands.trigger("StreamEnd", { track: gMM.sequencer.currentItem }); break; case Ci.sbIMediacoreEvent.STREAM_STOP: - dactyl.log("Track stopped: " + gMM.sequencer.currentItem); + dactyl.log(_("player.trackStop", gMM.sequencer.currentItem)); autocommands.trigger("StreamStop", { track: gMM.sequencer.currentItem }); break; } diff --git a/melodactyl/locale/en-US/messages.properties b/melodactyl/locale/en-US/messages.properties new file mode 100644 index 00000000..f5ec2170 --- /dev/null +++ b/melodactyl/locale/en-US/messages.properties @@ -0,0 +1,10 @@ +player.preTrackChange-1 = Before track changed: %S +player.postTrackChange-1 = Track changed: %S +player.preViewChange-1 = Before view changed: %S +player.postViewChange-1 = View changed: %S +player.trackStart-1 = Track started: %S +player.trackPause-1 = Track paused: %S +player.trackEnd-1 = Track ended: %S +player.trackStop-1 = Track stopped: %S + +# vim:se ft=jproperties tw=0: diff --git a/pentadactyl/content/config.js b/pentadactyl/content/config.js index 2dd3b532..f235982f 100644 --- a/pentadactyl/content/config.js +++ b/pentadactyl/content/config.js @@ -205,7 +205,7 @@ var Config = Module("config", ConfigBase, { let title = document.getElementById("sidebar-title"); dactyl.assert(args.length || title.value || args.bang && config.lastSidebar, - "Argument required"); + _("error.argumentRequired")); if (!args.length) return window.toggleSidebar(title.value ? null : config.lastSidebar); @@ -227,7 +227,7 @@ var Config = Module("config", ConfigBase, { return; } - return dactyl.echoerr("No sidebar " + args[0] + " found"); + return dactyl.echoerr(_("error.invalidArgument", args[0])); }, { argCount: "?", diff --git a/pentadactyl/locale/en-US/messages.properties b/pentadactyl/locale/en-US/messages.properties new file mode 100644 index 00000000..e3d5b3bf --- /dev/null +++ b/pentadactyl/locale/en-US/messages.properties @@ -0,0 +1,2 @@ + +# vim:se ft=jproperties tw=0: diff --git a/teledactyl/content/addressbook.js b/teledactyl/content/addressbook.js index 2a7dd1e5..53b60b19 100644 --- a/teledactyl/content/addressbook.js +++ b/teledactyl/content/addressbook.js @@ -63,9 +63,9 @@ const Addressbook = Module("addressbook", { if (addresses.length < 1) { if (!filter) - dactyl.echoerr("Exxx: No contacts", commandline.FORCE_SINGLELINE); + dactyl.echoerr(_("addressbook.noContacts"), commandline.FORCE_SINGLELINE); else - dactyl.echoerr("Exxx: No contacts matching string '" + filter + "'", commandline.FORCE_SINGLELINE); + dactyl.echoerr(_("addressbook.noMatchingContacts"), filter, commandline.FORCE_SINGLELINE); return false; } @@ -100,9 +100,9 @@ const Addressbook = Module("addressbook", { displayName = this.generateDisplayName(firstName, lastName); if (addressbook.add(mailAddr, firstName, lastName, displayName)) - dactyl.echomsg("Added address: " + displayName + " <" + mailAddr + ">", 1, commandline.FORCE_SINGLELINE); + dactyl.echomsg(_("addressbook.added", displayName, mailAddr), 1, commandline.FORCE_SINGLELINE); else - dactyl.echoerr("Exxx: Could not add contact `" + mailAddr + "'", commandline.FORCE_SINGLELINE); + dactyl.echoerr(_("addressbook.cantAdd", mailAddr), commandline.FORCE_SINGLELINE); }, { diff --git a/teledactyl/content/mail.js b/teledactyl/content/mail.js index ff01820c..9a6da8a9 100644 --- a/teledactyl/content/mail.js +++ b/teledactyl/content/mail.js @@ -70,9 +70,9 @@ const Mail = Module("mail", { _moveOrCopy: function (copy, destinationFolder, operateOnThread) { let folders = mail.getFolders(destinationFolder); if (folders.length == 0) - return void dactyl.echoerr("Exxx: No matching folder for " + destinationFolder); + return void dactyl.echoerr(_("addressbook.noMatchingFolder", destinationFolder)); else if (folders.length > 1) - return dactyl.echoerr("Exxx: More than one match for " + destinationFolder); + return dactyl.echoerr(_("addressbook.multipleFolderMatches", destinationFolder)); let count = gDBView.selection.count; if (!count) @@ -168,7 +168,7 @@ const Mail = Module("mail", { let url = args.attachments.pop(); let file = io.getFile(url); if (!file.exists()) - return void dactyl.echoerr("Exxx: Could not attach file `" + url + "'", commandline.FORCE_SINGLELINE); + return void dactyl.echoerr(_("mail.cantAttachFile", url), commandline.FORCE_SINGLELINE); attachment = Cc["@mozilla.org/messengercompose/attachment;1"].createInstance(Ci.nsIMsgAttachment); attachment.url = "file://" + file.path; @@ -402,7 +402,7 @@ const Mail = Module("mail", { let folder = mail.getFolders(arg, true, true)[count]; if (!folder) - dactyl.echoerr("Exxx: Folder \"" + arg + "\" does not exist"); + dactyl.echoerr(_("command.goto.folderNotExist", arg)); else if (dactyl.forceNewTab) MsgOpenNewTabForFolder(folder.URI); else @@ -434,7 +434,7 @@ const Mail = Module("mail", { // TODO: is there a better way to check for validity? if (addresses.some(function (recipient) !(/\S@\S+\.\S/.test(recipient)))) - return void dactyl.echoerr("Exxx: Invalid e-mail address"); + return void dactyl.echoerr(_("command.mail.invalidEmailAddress")); mail.composeNewMail(mailargs); }, diff --git a/teledactyl/locale/en-US/messages.properties b/teledactyl/locale/en-US/messages.properties new file mode 100644 index 00000000..ddc929b9 --- /dev/null +++ b/teledactyl/locale/en-US/messages.properties @@ -0,0 +1,14 @@ +addressbook.noContacts = No contacts +addressbook.noMatchingContacts-1 = No contacts matching '%S' +addressbook.added-2 = Added address: %S <%S> +addressbook.cantAdd-1 = Could not add contact '%S' + +command.goto.folderNotExist-1 = Folder '%S' does not exist +command.mail.invalidEmailAddress = Invalid e-mail address + +mail.noMatchingFolder-1 = No matching folder for %S +mail.multipleFolderMatches-1 = More than one match for %S +mail.cantAttachFile = Could not attach file '%S' + +# vim:se ft=jproperties tw=0: +