stringbundle

An element which can be used to load localized resources from property files. Stringbundles should be placed inside a stringbundleset element.

A property file is a list of property key-value pairs each on a separate line. The key and value is separated with an equals sign. For example, the following defines two properties:

message.displayError=An error occured trying to display this message
message.nameAlreadyUsed=The name %S is already being used by another account.

More information is available in the XUL tutorial.

The "src" attribute accepts only absolute chrome:// URLs (see bugs 133698, 26291)
Attributes
src
Properties
appLocale , src, stringBundle, strings
Methods
getFormattedString, getString

Examples

(example needed)

Attributes

src
Type: URI
The URI of the property file that contains the localized strings.

Inherited from XUL element
align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width

Properties

appLocale Obsolete since Gecko 1.9.1
Type: nsILocale
Returns the XPCOM object which holds information about the user's locale. This is an object which implements nsILocale.
src
Type: URL
Gets and sets the value of the src attribute.
stringBundle
Type: nsIStringBundle
Returns the XPCOM string bundle object which implements nsIStringBundle.
strings
Type: nsISimpleEnumerator
An enumeration of all of the strings in the string bundle. The enumeration contains nsIPropertyElement objects.

Methods

getFormattedString( key, strArray )
Return type: string
Looks up the format string for the given key name in the string bundle and returns a formatted copy where each occurrence of %S (uppercase) is replaced by each successive element in the supplied array. Alternatively, numbered indices of the format %n$S (e.g. %1$S, %2$S, etc.) can be used to specify the position of the corresponding parameter explicitly.

If you need to handle substitutions involving plurals, take a look at Localization and Plurals.

getString( key )
Return type: string
Returns the string with the given <var>key</var> name from the string bundle.

Inherited Methods
addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData

Document Tags and Contributors

Contributors to this page: Sheppy, Mgjbot, Marsf, Trentm, Ptak82, Wjjohnst, Dria, vladimir.dzhuvinov
Last updated by: Sheppy,