mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 17:27:59 +01:00
Allow fallback to en-US for missing files in the selected locale.
This commit is contained in:
@@ -190,9 +190,9 @@ Dactyl.prototype = {
|
|||||||
return redirect("dactyl://help/" + this.HELP_TAGS[tag] + "#" + tag.replace(/#/g, encodeURIComponent), uri);
|
return redirect("dactyl://help/" + this.HELP_TAGS[tag] + "#" + tag.replace(/#/g, encodeURIComponent), uri);
|
||||||
break;
|
break;
|
||||||
case "locale":
|
case "locale":
|
||||||
return makeChannel(["resource://dactyl-locale", config.locale, path].join("/"), uri);
|
return LocaleChannel("dactyl-locale", path, uri);
|
||||||
case "locale-local":
|
case "locale-local":
|
||||||
return makeChannel(["resource://dactyl-local-locale", config.locale, path].join("/"), uri);
|
return LocaleChannel("dactyl-local-locale", path, uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
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) {
|
function StringChannel(data, contentType, uri) {
|
||||||
let channel = services.StreamChannel(uri);
|
let channel = services.StreamChannel(uri);
|
||||||
channel.contentStream = services.StringStream(data);
|
channel.contentStream = services.StringStream(data);
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ var JavaScript = Module("javascript", {
|
|||||||
let globals = values(toplevel && this.window === obj ? this.globalNames : []);
|
let globals = values(toplevel && this.window === obj ? this.globalNames : []);
|
||||||
|
|
||||||
if (toplevel && isObject(obj) && "wrappedJSObject" in obj)
|
if (toplevel && isObject(obj) && "wrappedJSObject" in obj)
|
||||||
yield "wrappedJSObject";
|
if (!set.add(seen, "wrappedJSObject"))
|
||||||
|
yield "wrappedJSObject";
|
||||||
|
|
||||||
for (let key in iter(globals, properties(obj, !toplevel, true)))
|
for (let key in iter(globals, properties(obj, !toplevel, true)))
|
||||||
if (!set.add(seen, key))
|
if (!set.add(seen, key))
|
||||||
|
|||||||
Reference in New Issue
Block a user