Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIStringBundleService

Provides the string bundle service, which provides a way to fetch localized strings from a property file.
Inherits from: nsISupports Last changed in Gecko 1.7

Implemented by: @mozilla.org/intl/stringbundle;1. To access this service, use:

var stringBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
                                    .getService(Components.interfaces.nsIStringBundleService);

Method overview

nsIStringBundle createBundle(in string aURLSpec);
nsIStringBundle createExtensibleBundle(in string aRegistryKey);
void flushBundles();
wstring formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);

Methods

createBundle()

nsIStringBundle createBundle(
  in string aURLSpec
);
Parameters
aURLSpec
The URL of the properties file to load. This is typically a locale URL, e.g. chrome://global/locale/global.properties
Return value

A string bundle corresponding to the properties file. This string bundle has functions available on it.

On the return value object on you can call functions like GetStringFromName and formatStringFromName see nsIStringBundle.

 

createExtensibleBundle()

nsIStringBundle createExtensibleBundle(
  in string aRegistryKey
);
Parameters
aRegistryKey
The name of the category under which the properties file(s) have been registered.
Return value

An extensible bundle corresponding to the properties file(s).

flushBundles()

Flushes the string bundle cache - useful when the locale changes or when we need to get some extra memory back. (Automatically called for the memory-pressure and chrome-flush-caches global observer topics.)

void flushBundles();
Parameters

None.

formatStatusMessage()

Formats a message string from a status code and status arguments. Typically used to format a message received by a nsIProgressEventSink's onStatus method.

wstring formatStatusMessage(
  in nsresult aStatus,
  in wstring aStatusArg
);
Parameters
aStatus
The status code. This is mapped into a string ID and and used in the string lookup process (see nsIErrorService).
aStatusArg
The status message argument(s). Multiple arguments can be separated by newline ('\n') characters.
Return value

The formatted message.

See also

Document Tags and Contributors

 Contributors to this page: Noitidart, Sheppy, Neil, Wjjohnst, trevorh
 Last updated by: Noitidart,