1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 23:34:15 +01:00

Localeify more strings.

This commit is contained in:
Kris Maglione
2011-03-15 20:14:01 -04:00
parent 4a552b14aa
commit 2d03f3f9ca
9 changed files with 63 additions and 34 deletions

View File

@@ -22,8 +22,8 @@ var callResult = function callResult(method) {
var listener = function listener(action, event)
function addonListener(install) {
this.dactyl[install.error ? "echoerr" : "echomsg"](
"Add-on " + action + " " + event + ": " + (install.name || install.sourceURI.spec) +
(install.error ? ": " + addonErrors[install.error] : ""));
_("addon.error", action, event, (install.name || install.sourceURI.spec) +
(install.error ? ": " + addons.errors[install.error] : "")));
}
var AddonListener = Class("AddonListener", {
@@ -68,8 +68,8 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
if (!this.remaining.length)
this.dactyl.echomsg(
this.upgrade.length
? "Installing updates for addons: " + this.upgrade.map(function (i) i.name).join(", ")
: "No addon updates found");
? _("addon.installingUpdates", this.upgrade.map(function (i) i.name).join(", "))
: _("addon.noUpdates"));
}
});
@@ -151,11 +151,11 @@ var Addon = Class("Addon", {
<td highlight="AddonVersion" key="version"/>
<td highlight="AddonStatus" key="status"/>
<td highlight="AddonButtons Buttons">
<a highlight="Button" key="enable">On&#xa0;</a>
<a highlight="Button" key="disable">Off</a>
<a highlight="Button" key="delete">Del</a>
<a highlight="Button" key="update">Upd</a>
<a highlight="Button" key="options">Opt</a>
<a highlight="Button" key="enable">{_("addon.action.On")}</a>
<a highlight="Button" key="disable">{_("addon.action.Off")}</a>
<a highlight="Button" key="delete">{_("addon.action.Del")}</a>
<a highlight="Button" key="update">{_("addon.action.Upd")}</a>
<a highlight="Button" key="options">{_("addon.action.Opt")}</a>
</td>
<td highlight="AddonDescription" key="description"/>
</tr>,
@@ -347,6 +347,11 @@ var AddonList = Class("AddonList", {
});
var Addons = Module("addons", {
errors: Class.memoize(function ()
array(["ERROR_NETWORK_FAILURE", "ERROR_INCORRECT_HASH",
"ERROR_CORRUPT_FILE", "ERROR_FILE_ACCESS"])
.map(function (e) [AddonManager[e], _("AddonManager." + e)])
.toObject())
}, {
}, {
commands: function (dactyl, modules, window) {
@@ -595,12 +600,6 @@ else
}
};
var addonErrors = array.toObject([
[AddonManager.ERROR_NETWORK_FAILURE, "A network error occurred"],
[AddonManager.ERROR_INCORRECT_HASH, "The downloaded file did not match the expected hash"],
[AddonManager.ERROR_CORRUPT_FILE, "The file appears to be corrupt"],
[AddonManager.ERROR_FILE_ACCESS, "There was an error accessing the filesystem"]]);
endModule();
} catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }

View File

@@ -863,9 +863,9 @@ var Commands = Module("commands", {
let [count, arg, quote] = Commands.parseArg(str, null, _keepQuotes);
if (quote == "\\" && !complete)
return [, , , "Trailing \\"];
return [, , , _("error.trailing", "\\")];
if (quote && !complete)
return [, , , "E114: Missing quote: " + quote];
return [, , , _("error.missingQuote", quote)];
return [count, arg, quote];
}
@@ -1351,7 +1351,7 @@ var Commands = Module("commands", {
// dynamically get completions as specified with the command's completer function
context.highlight();
if (!command) {
context.message = "No such command: " + match.cmd;
context.message = _("command.noSuch", match.cmd);
context.highlight(0, match.cmd.length, "SPELLCHECK");
return;
}
@@ -1591,7 +1591,7 @@ var Commands = Module("commands", {
dactyl.clipboardWrite(res);
let lines = res.split("\n").length;
dactyl.echomsg("Yanked " + lines + " line" + (lines == 1 ? "" : "s"));
dactyl.echomsg(_("command.yank.yankedLine" + (lines == 1 ? "" : "s"), lines));
},
{
completer: function (context) modules.completion[/^:/.test(context.filter) ? "ex" : "javascript"](context),

View File

@@ -11,7 +11,7 @@ try {
Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("completion", {
exports: ["CompletionContext", "Completion", "completion"],
use: ["config", "template", "util"]
use: ["config", "messages", "template", "util"]
}, this);
/**
@@ -331,7 +331,7 @@ var CompletionContext = Class("CompletionContext", {
* The message displayed at the head of the completions for the
* current context.
*/
get message() this._message || (this.waitingForTab && this.hasItems !== false ? "Waiting for <Tab>" : null),
get message() this._message || (this.waitingForTab && this.hasItems !== false ? _("completion.waitingFor", "<Tab>") : null),
set message(val) this._message = val,
/**

View File

@@ -237,7 +237,7 @@ var Contexts = Module("contexts", {
group = this.addGroup(commands.nameRegexp
.iterate(name.replace(/\.[^.]*$/, ""))
.join("-").replace(/--+/g, "-"),
"Script group for " + file.path,
_("context.scriptGroup", file.path),
null, false);
Class.replaceProperty(self, "GROUP", group);

View File

@@ -7,7 +7,7 @@
Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("downloads", {
exports: ["Download", "Downloads", "downloads"],
use: ["io", "prefs", "services", "util"]
use: ["io", "messages", "prefs", "services", "util"]
}, this);
Cu.import("resource://gre/modules/DownloadUtils.jsm", this);
@@ -39,12 +39,12 @@ var Download = Class("Download", {
</td>
<td highlight="DownloadState" key="state"/>
<td highlight="DownloadButtons Buttons">
<a highlight="Button" key="pause">Pause</a>
<a highlight="Button" key="remove">Remove</a>
<a highlight="Button" key="resume">Resume</a>
<a highlight="Button" key="retry">Retry</a>
<a highlight="Button" key="cancel">Cancel</a>
<a highlight="Button" key="delete">Delete</a>
<a highlight="Button" key="pause">{_("download.action.Pause")}</a>
<a highlight="Button" key="remove">{_("download.action.Remove")}</a>
<a highlight="Button" key="resume">{_("download.action.Resume")}</a>
<a highlight="Button" key="retry">{_("download.action.Retry")}</a>
<a highlight="Button" key="cancel">{_("download.action.Cancel")}</a>
<a highlight="Button" key="delete">{_("download.action.Delete")}</a>
</td>
<td highlight="DownloadProgress" key="progress">
<span highlight="DownloadProgressHave" key="progressHave"

View File

@@ -385,8 +385,8 @@ var Highlights = Module("Highlight", {
let group = args[0] && highlight.get(args[0]);
if (group)
context.fork("extra", 0, this, function (context) [
[String(group.extends), "Current Value"],
[String(group.defaultExtends) || "", "Default Value"]
[String(group.extends), _("option.currentValue")],
[String(group.defaultExtends) || "", _("option.defaultValue")]
]);
context.fork("groups", 0, completion, "highlightGroup");
}

View File

@@ -11,7 +11,7 @@ try {
Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("javascript", {
exports: ["JavaScript", "javascript"],
use: ["services", "template", "util"]
use: ["messages", "services", "template", "util"]
}, this);
let isPrototypeOf = Object.prototype.isPrototypeOf;
@@ -128,7 +128,7 @@ var JavaScript = Module("javascript", {
}
catch (e) {
util.reportError(e);
this.context.message = "Error: " + e;
this.context.message = _("error.error", e);
return null;
}
finally {
@@ -598,7 +598,7 @@ var JavaScript = Module("javascript", {
// Wait for a keypress before completing when there's no key
if (!this.context.tabPressed && key == "" && obj.length > 1) {
this.context.waitingForTab = true;
this.context.message = "Waiting for key press";
this.context.message = _("completion.waitingForKeyPress");
return null;
}