Pacotemx.resources
Classepublic class ResourceBundle
HerançaResourceBundle Inheritance Object
Implementa IResourceBundle

This class provides an implementation of the IResourceBundle interface. The IResourceManager and IResourceBundle interfaces work together to provide internationalization support for Flex applications.

A Flex application typically has multiple instances of this class, all managed by a single instance of the ResourceManager class. It is possible to have ResourceBundle instances for multiple locales, each for each locale there can be multiple ResourceBundles with different bundle names.

Veja também

mx.resources.IResourceBundle
mx.resources.IResourceManager


Propriedades Públicas
 PropriedadeDefinido por
  bundleName : String
[read-only] A name that identifies this resource bundle, such as "MyResources".
ResourceBundle
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  content : Object
[read-only] An Object containing key/value pairs for the resources in this resource bundle.
ResourceBundle
  locale : String
[read-only] The locale for which this bundle's resources have been localized.
ResourceBundle
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Métodos Públicos
 MétodoDefinido por
  
ResourceBundle(locale:String = null, bundleName:String = null)
Constructor.
ResourceBundle
  
getBoolean(key:String, defaultValue:Boolean = true):Boolean
Gets a Boolean from a ResourceBundle.
ResourceBundle
  
Gets a Number from a ResourceBundle.
ResourceBundle
  
Gets an Object from a ResourceBundle.
ResourceBundle
  
getResourceBundle(baseName:String, currentDomain:ApplicationDomain = null):ResourceBundle
[static] If you compiled your application for a single locale, this method can return a ResourceBundle when provided with a resource bundle name, This method has been deprecated because the Flex framework now supports having resource bundles for multiple locales in the same application.
ResourceBundle
  
Gets a String from a ResourceBundle.
ResourceBundle
  
Gets an Array of Strings from a ResourceBundle.
ResourceBundle
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Métodos Protegidos
 MétodoDefinido por
  
When a .properties file is compiled into a resource bundle, the MXML compiler autogenerates a subclass of ResourceBundle.
ResourceBundle
Detalhes da propriedade
bundleNamepropriedade
bundleName:String  [read-only]

A name that identifies this resource bundle, such as "MyResources".

This read-only property is set when a resource bundle is constructed.

Resource bundles that are automatically created from compiled .properties files have bundle names based on the names of those files. For exemplo, a .properties file named MyResources.properties will produce a resource bundle whose bundleName is "MyResources".

The ResourceManager can manage multiple bundles with the same bundleName as long as they have different values for their locale property.


Implementação
    public function get bundleName():String
contentpropriedade 
content:Object  [read-only]

An Object containing key/value pairs for the resources in this resource bundle.

In general, you should access resources using IResourceManager methods such as getString(), rather than directly accessing them in a resource bundle. However, if you are programmatically creating your own resource bundles, you can initialize them with resources as follows:

   var rb:IResourceBundle = new ResourceBundle("fr_FR", "MyResources");
   rb.content["LANGUAGE"] = "Francais";
   rb.content["GREETING"] = "Bonjour";
   

When a resource bundle is produced by compiling a .properties file, its resource values are either of type String or Classe. For exemplo, if the .properties file contains

   LANGUAGE=English
   MINIMUM_AGE=18
   ENABLED=true
   LOGO=Embed("logo.png")
   

then the value of the LANGUAGE resource is the String "English", the value of the MINIMUM_AGE resource is the String "18", the value of the ENABLED resource is the String "true", and the value of the LOGO resource is a Classe that represents the embedded PNG file.

You can use IResourceManager methods such as getInt() and getBoolean() to convert resource strings like "18" and "true" into the type that your code expects.


Implementação
    public function get content():Object
localepropriedade 
locale:String  [read-only]

The locale for which this bundle's resources have been localized. This is a String such as "en_US" for U.S. English.

This read-only property is set when a resource bundle is constructed.

Resource bundles that are automatically created from compiled .properties files have locales based on the -compiler.locale option of mxmlc or compc. For exemplo, suppose that you compile your application with the option -compiler.locale=en_US,ja_JP and that you have specified -compiler.source-path=resources/{locale} so that your application's resources, located in resources/en_US/MyResources.properties and resources/ja_JP/MyResources.properties, are found. Then your application will have two resource bundles whose bundleName is "MyResources", one whose locale is "en_US" and one whose locale is "ja_JP".


Implementação
    public function get locale():String
Detalhes do construtor
ResourceBundle()Construtor
public function ResourceBundle(locale:String = null, bundleName:String = null)

Constructor.

Parâmetros
locale:String (default = null) — A locale string, such as "en_US".
 
bundleName:String (default = null) — A name which identifies this bundle, such as "MyResources".
Detalhes do método
getBoolean()método
public function getBoolean(key:String, defaultValue:Boolean = true):Boolean
Deprecated Since 3.0: Please use ResourceManager.getBoolean()

Gets a Boolean from a ResourceBundle.

If the resource specified by the key parameter does not exist in this bundle, this method throws an Error.

This method has been deprecated because all resources should now be accessed via methods of the IResourceManager interface. You should convert your code to instead call the getBoolean()method of IResourceManager. All classes that extend UIComponent, Formatter, or Validator have a resourceManager property which provides a reference to an object implementing this interface. Other classes can call ResourceManager.getInstance() to obtain this object.

Parâmetros

key:String — A String identifying a resource in this ResourceBundle.
 
defaultValue:Boolean (default = true) — The value to return if the resource value, after being converted to lowercase, is neither the String "true" nor the String "false". This parameter is optional; its default value is true.

Retorna
Boolean — The value of the specified resource, as a Boolean.
getContent()método 
protected function getContent():Object

When a .properties file is compiled into a resource bundle, the MXML compiler autogenerates a subclass of ResourceBundle. The subclass overrides this method to return an Object containing key/value pairs for the bundle's resources.

If you are creating you own ResourceBundle instances, you can simply set key/value pairs on the content Object.

Retorna
Object
getNumber()método 
public function getNumber(key:String):Number
Deprecated Since 3.0: Please use ResourceManager.getNumber()

Gets a Number from a ResourceBundle.

If the resource specified by the key parameter does not exist in this bundle, this method throws an Error.

This method has been deprecated because all resources should now be accessed via methods of the IResourceManager interface. You should convert your code to instead call the getNumber(), getInt(), or getUint() method of IResourceManager. All classes that extend UIComponent, Formatter, or Validator have a resourceManager property which provides a reference to an object implementing this interface. Other classes can call ResourceManager.getInstance() to obtain this object.

Parâmetros

key:String — A String identifying a resource in this ResourceBundle.

Retorna
Number — The value of the specified resource, as a Number.
getObject()método 
public function getObject(key:String):Object
Deprecated Since 3.0: Please use ResourceManager.getObject()

Gets an Object from a ResourceBundle.

If the resource specified by the key parameter does not exist in this bundle, this method throws an Error.

This method has been deprecated because all resources should now be accessed via methods of the IResourceManager interface. You should convert your code to instead call the getObject() or getClass() method of IResourceManager. All classes that extend UIComponent, Formatter, or Validator have a resourceManager property which provides a reference to an object implementing this interface. Other classes can call ResourceManager.getInstance() to obtain this object.

Parâmetros

key:String — A String identifying a resource in this ResourceBundle.

Retorna
Object — An Object which is the value of the specified resource.
getResourceBundle()método 
public static function getResourceBundle(baseName:String, currentDomain:ApplicationDomain = null):ResourceBundle
Deprecated Since 3.0: Please use ResourceManager.getResourceBundle()

If you compiled your application for a single locale, this method can return a ResourceBundle when provided with a resource bundle name,

This method has been deprecated because the Flex framework now supports having resource bundles for multiple locales in the same application. You can use the getResourceBundle() method of IResourceManager to get a resource bundle if you know its bundle name and locale. However, yhou should no longer access resources directly from a ResourceBundle. All resources should now be accessed via methods of the IResourceManager interface such as getString(). All classes that extend UIComponent, Formatter, or Validator have a resourceManager property which provides a reference to an object implementing this interface. Other classes can call ResourceManager.getInstance() to obtain this object.

Parâmetros

baseName:String
 
currentDomain:ApplicationDomain (default = null)

Retorna
ResourceBundle
getString()método 
public function getString(key:String):String
Deprecated Since 3.0: Please use ResourceManager.getString()

Gets a String from a ResourceBundle.

If the resource specified by the key parameter does not exist in this bundle, this method throws an Error.

This method has been deprecated because all resources should now be accessed via methods of the IResourceManager interface. You should convert your code to instead call the getString() method of IResourceManager. All classes that extend UIComponent, Formatter, or Validator have a resourceManager property which provides a reference to an object implementing this interface. Other classes can call ResourceManager.getInstance() to obtain this object.

Parâmetros

key:String — A String identifying a resource in this ResourceBundle.

Retorna
String — The value of the specified resource, as a String.
getStringArray()método 
public function getStringArray(key:String):Array
Deprecated Since 3.0: Please use ResourceManager.getStringArray()

Gets an Array of Strings from a ResourceBundle.

The Array is produced by assuming that the actual value of the resource is a String containing comma-separated items, such as "India, China, Japan". After splitting the String at the commas, any whitespace before or after each item is trimmed.

If the resource specified by the key parameter does not exist in this bundle, this method throws an Error.

This method has been deprecated because all resources should now be accessed via methods of the IResourceManager interface. You should convert your code to instead call the getStringArray() method of IResourceManager. All classes that extend UIComponent, Formatter, or Validator have a resourceManager property which provides a reference to an object implementing this interface. Other classes can call ResourceManager.getInstance() to obtain this object.

Parâmetros

key:String — A String identifying a resource in this ResourceBundle.

Retorna
Array — The value of the specified resource, as an Array of Strings.