loadResources

loadResources

Loads a properties file.

Method of

Install object

Syntax

Object loadResources( String xpiPath );

Parameters

The sole input parameter for loadResources is a string representing the path to the properties file in the XPI in which the key/value pairs are defined.

Returns

A JavaScript object whose property names are the keys from that file and whose values are the strings.

Description

The format of the properties file expected by loadResources is the same as that of the chrome locale .properties files. This method is used to internationalize installation scripts by allowing the installer to retrieve localized string values from a separate file. Be aware that the parameter specifies the file within the XPI and not on the file system, as the following example demonstrates.

Example

Given a XPI with this internal structure:

install.js
bin/res_eg_2.properties
bin/somefile.exe
bin/...

The following lines retrieve the properties as a JavaScript object and make the values accessible with the familiar "dot property" syntax:

resEg2Obj = loadResources("bin/res_eg_2.properties");
dump( resEg2Obj.title )

Document Tags and Contributors

Contributors to this page: Sheppy, trevorh, Fredchat, Rod Whiteley
Last updated by: Sheppy,
Hide Sidebar