MessageManager.importBundle Member

Syntax

object.importBundle(bundle, targetWindow, index);

Arguments

ArgumentSummary
bundle
targetWindow
index

Returns

Remarks

See Also

Source Code

function mm_importbundle(bundle, targetWindow, index)
{
var me = this;
function replaceEntities(matched, entity)
{
if (entity in me.entities)
return me.entities[entity];
return matched;
};
const nsIPropertyElement = Components.interfaces.nsIPropertyElement;
if (!targetWindow)
targetWindow = window;
if (typeof index == "undefined")
index = arrayIndexOf(this.bundleList, bundle);
var pfx;
if (index == 0)
pfx = "";
else
pfx = index + ":";
var enumer = bundle.getSimpleEnumeration();
while (enumer.hasMoreElements())
{
var prop = enumer.getNext().QueryInterface(nsIPropertyElement);
var ary = prop.key.match (/^(msg|msn)/);
if (ary)
{
var constValue;
var constName = prop.key.toUpperCase().replace (/\./g, "_");
if (ary[1] == "msn" || prop.value.search(/%(\d+\$)?s/i) != -1)
constValue = pfx + prop.key;
else
constValue = prop.value.replace (/^\"/, "").replace (/\"$/, "");
constValue = constValue.replace(/\&(\w+)\;/g, replaceEntities);
targetWindow[constName] = constValue;
}
}
if (this.bundleList.length == 1)
this.defaultBundle = bundle;
}