| Package | org.granite.util |
| Class | public class InternalBundle |
| Subclasses | ValidationMessages |
Bundles loaded by this class must be in the Java XML properties format, ie:
<properties>
<entry key="hello.world">Salut tout le monde!</entry>
</properties>
| Method | Defined by | ||
|---|---|---|---|
|
InternalBundle(bundleName:String)
Constructs a new
InternalBundle instance. | InternalBundle | ||
|
getString(resourceName:String, parameters:Array = null, locale:String = null):String
Look for a resource named
resourceName in the loaded Flex application
bundles (with the bundle name provided at creation time) and, if it cannot be found,
look for it in this internal bundle properties. | InternalBundle | ||
| Method | Defined by | ||
|---|---|---|---|
|
addBundle(locale:String, properties:XML, defaultBundle:Boolean = false):void
Add XML resources properties for the given locale.
| InternalBundle | ||
| InternalBundle | () | constructor |
public function InternalBundle(bundleName:String)
Constructs a new InternalBundle instance.
bundleName:String — the name of this resources bundle, that will be
used for standard Flex ResourceManager looking.
|
See also
| addBundle | () | method |
protected function addBundle(locale:String, properties:XML, defaultBundle:Boolean = false):voidAdd XML resources properties for the given locale.
Parameterslocale:String — the locale in which the properties are given (eg: "fr" or "fr_FR").
|
|
properties:XML — a XML object that contains resources properties for the locale.
|
|
defaultBundle:Boolean (default = false) — true if this bundle should be used as a fallback
bundle when a resource for a given locale cannot be found. Default is
false.
|
| getString | () | method |
public function getString(resourceName:String, parameters:Array = null, locale:String = null):String
Look for a resource named resourceName in the loaded Flex application
bundles (with the bundle name provided at creation time) and, if it cannot be found,
look for it in this internal bundle properties.
Locale resolution with internal bundles is performed by using the usual Java algorithm:
if "fr_FR" is passed as the locale (or if it appears in the current locale chain), this
class will first try to find a bundle for this exact locale (as passed to the
addBundle method); if no such bundle can be found, it will try to find a
bundle for the less restrictive "fr" locale; if it fails again, it will try to use the
default bundle.
If a parameters array is passed to this method, the parameters in it
are converted to Strings and then substituted, in order, for the placeholders
"{0}", "{1}", and so on, in the string before it is returned.
If the specified resource is not found, this method returns null.
ParametersresourceName:String — the name of a resource in the resource bundle.
|
|
parameters:Array (default = null) — an Array of parameters that are substituted for the placeholders.
Each parameter is converted to a String with the toString() method before
being substituted.
|
|
locale:String (default = null) — a specific locale to be used for the lookup, or null to search all
locales in the localeChain. This parameter is optional and defaults to null; you
should seldom need to specify it.
|
String — the resource value, or null if it is not found.
|