I volontari di MDN non hanno ancora tradotto questo articolo in Italiano. Unisciti a noi e traducilo tu stesso.
Puoi anche consultare l’articolo in English (US).

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"]

Method overview

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



nsIStringBundle createBundle(
  in string 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.



nsIStringBundle createExtensibleBundle(
  in string 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).


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();



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
The status code. This is mapped into a string ID and and used in the string lookup process (see nsIErrorService).
The status message argument(s). Multiple arguments can be separated by newline ('\n') characters.
Return value

The formatted message.

See also

Tag del documento e collaboratori

Hanno collaborato alla realizzazione di questa pagina: Noitidart, Sheppy, Neil, Wjjohnst, trevorh
Ultima modifica di: Noitidart,