1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 05:57:59 +01:00

Allow fallback to en-US for missing files in the selected locale.

This commit is contained in:
Kris Maglione
2011-03-04 18:34:35 -05:00
parent ae5b61bf20
commit c82138567e
2 changed files with 13 additions and 3 deletions

View File

@@ -190,9 +190,9 @@ Dactyl.prototype = {
return redirect("dactyl://help/" + this.HELP_TAGS[tag] + "#" + tag.replace(/#/g, encodeURIComponent), uri);
break;
case "locale":
return makeChannel(["resource://dactyl-locale", config.locale, path].join("/"), uri);
return LocaleChannel("dactyl-locale", path, uri);
case "locale-local":
return makeChannel(["resource://dactyl-local-locale", config.locale, path].join("/"), uri);
return LocaleChannel("dactyl-local-locale", path, uri);
}
}
catch (e) {
@@ -216,6 +216,15 @@ Dactyl.prototype = {
}
};
function LocaleChannel(base, path, orig) {
for each (let locale in [config.locale, "en-US"]) {
var channel = makeChannel(["resource:/", base, config.locale, path].join("/"), orig);
if (channel.name !== DNE)
break;
}
return channel;
}
function StringChannel(data, contentType, uri) {
let channel = services.StreamChannel(uri);
channel.contentStream = services.StringStream(data);

View File

@@ -75,6 +75,7 @@ var JavaScript = Module("javascript", {
let globals = values(toplevel && this.window === obj ? this.globalNames : []);
if (toplevel && isObject(obj) && "wrappedJSObject" in obj)
if (!set.add(seen, "wrappedJSObject"))
yield "wrappedJSObject";
for (let key in iter(globals, properties(obj, !toplevel, true)))