+ /**
+ * Exports known localizable strings to a properties file.
+ *
+ * @param {string|nsIFile} {file} The file to which to export
+ * the strings.
+ */
+ export: function export_(file) {
+ let { Buffer, commands, hints, io, mappings, modes, options, sanitizer } = overlay.activeModules;
+ file = io.File(file);
+
+ function properties(base, iter_, prop) iter(function _properties() {
+ function key() [base, obj.identifier || obj.name].concat(Array.slice(arguments)).join(".").replace(/[\\:=]/g, "\\$&");
+
+ prop = prop || "description";
+ for (var obj in iter_) {
+ if (!obj.hive || obj.hive.name !== "user") {
+ yield key(prop) + " = " + obj[prop];
+
+ if (iter_.values)
+ for (let [k, v] in isArray(obj.values) ? array.iterValues(obj.values) : iter(obj.values))
+ yield key("values", k) + " = " + v;
+
+ for (let opt in values(obj.options))
+ yield key("options", opt.names[0]) + " = " + opt.description;
+
+ if (obj.deprecated)
+ yield key("deprecated") + " = " + obj.deprecated;
+ }
+ }
+ }()).toArray();
+
+ file.write(
+ array(commands.allHives.map(function (h) properties("command", h)))
+ .concat(modes.all.map(function (m)
+ properties("map", values(mappings.builtin.getStack(m)
+ .filter(function (map) map.modes[0] == m)))))
+ .concat(properties("mode", values(modes.all.filter(function (m) !m.hidden))))
+ .concat(properties("option", options))
+ .concat(properties("hintmode", values(hints.modes), "prompt"))
+ .concat(properties("pageinfo", values(Buffer.pageInfo), "title"))
+ .concat(properties("sanitizeitem", values(sanitizer.itemMap)))
+ .flatten().uniq().join("\n"));
+ }