1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 16:17:59 +01:00

Provide for localized plugin help.

This commit is contained in:
Kris Maglione
2010-11-18 17:12:10 -05:00
parent b01dde9b24
commit dba1b75edb
2 changed files with 26 additions and 3 deletions

View File

@@ -485,9 +485,25 @@ const Dactyl = Module("dactyl", {
let body = XML(); let body = XML();
for (let [, context] in Iterator(plugins.contexts)) for (let [, context] in Iterator(plugins.contexts))
if (context && context.INFO instanceof XML) if (context && context.INFO instanceof XML) {
let info = context.INFO;
if (info.*.@lang.length()) {
let langs = set([String(a) for each (a in info.*.@lang)]);
let lang = [window.navigator.language,
window.navigator.language.replace(/-.*/, ""),
"en", "en-US", info.*.@lang[0]
].filter(function (l) set.has(langs, l))[0];
info.* = info.*.(function::attribute("lang").length() == 0 || @lang == lang);
for each (let elem in info.NS::info)
for each (let attr in ["@name", "@summary", "@href"])
if (elem[attr].length())
info[attr] = elem[attr];
}
body += <h2 xmlns={NS.uri} tag={context.INFO.@name + '-plugin'}>{context.INFO.@summary}</h2> + body += <h2 xmlns={NS.uri} tag={context.INFO.@name + '-plugin'}>{context.INFO.@summary}</h2> +
context.INFO; context.INFO;
}
let help = let help =
'<?xml version="1.0"?>\n' + '<?xml version="1.0"?>\n' +

View File

@@ -108,16 +108,23 @@
</dl> </dl>
<dl> <dl>
<dt>Plugins</dt><dd/> <dt>Plugins</dt><dd/>
<dt>@lang</dt> <dd>When applied to any element under
&lt;plugin>, that element is only visible for a specific
locale.</dd>
<dt>plugin</dt> <dd>The container tag used for describing a plugin.</dd> <dt>plugin</dt> <dd>The container tag used for describing a plugin.</dd>
<dt>&tab;@name</dt> <dd>The name of the plugin. Used as the plugin's help tag.</dd> <dt>&tab;@name</dt> <dd>The name of the plugin. Used as the plugin's help tag.</dd>
<dt>&tab;@version</dt> <dd>The plugin's version number.</dd> <dt>&tab;@version</dt> <dd>The plugin's version number.</dd>
<dt>&tab;@href</dt> <dd>The plugin's home page.</dd> <dt>&tab;@href</dt> <dd>The plugin's home page.</dd>
<dt>&tab;@summary</dt> <dd>A short description of the plugin, shown in its section head.</dd> <dt>&tab;@summary</dt> <dd>A short description of the plugin, shown in its section head.</dd>
<dt>info</dt> <dd>An element with the same
attributes as plugin, which may override the latter for
specific locales</dd>
<dt>project</dt> <dd>The project for which this plugin was intended.</dd> <dt>project</dt> <dd>The project for which this plugin was intended.</dd>
<dt>&tab;@name</dt> <dd>The name of the project (i.e., <str>&dactyl.appName;</str>)</dd> <dt>&tab;@name</dt> <dd>The name of the project (i.e., <str>&dactyl.appName;</str>)</dd>
<dt>&tab;@minVersion</dt> <dd>The minimum version of the project for which this plugin is intended to work.</dd> <dt>&tab;@min-version</dt> <dd>The minimum version of the project for which this plugin is intended to work.</dd>
<dt>&tab;@maxVersion</dt> <dd>The maximum version of the project for which this plugin is intended to work.</dd> <dt>&tab;@max-version</dt> <dd>The maximum version of the project for which this plugin is intended to work.</dd>
<dt>author</dt> <dd>The plugin's author. May appear more than once.</dd> <dt>author</dt> <dd>The plugin's author. May appear more than once.</dd>
<dt>&tab;@href</dt> <dd>The author's home page.</dd> <dt>&tab;@href</dt> <dd>The author's home page.</dd>