Packageorg.granite.validation
Classpublic class ValidationMessages
InheritanceValidationMessages Inheritance InternalBundle

The ValidationMessages class is responsible of loading standard validation resources bundles. Three language are provided by default: english, french, german (as in the JSR-303 default implementation) and chinese.

The name of this bundle is "ValidationMessages", add it is possible to override default resources or to add new ones programatically (see Flex documentation). Here is a sample of such an override and addition (here at runtime):

  var validationBundle:ResourceBundle = new ResourceBundle("en_US", ValidationMessages.NAME);
  
  // override of the default Size message ("size must be between {min} and {max}").
  validationBundle.content["javax.validation.constraints.Size.message"] = "Size should be in [{min}, {max}]";
  
  // add a new message.
  validationBundle.content["my.validation.SpecialConstraint.message"] = "Value must be special";
  
  ResourceManager.getInstance().addResourceBundle(validationBundle);
  ResourceManager.getInstance().update();
  ResourceManager.getInstance().localeChain = ["en_US"];
  

See also

http://livedocs.adobe.com/flex/3/html/l10n_2.html


Public Methods
 MethodDefined by
  
[static] Returns a unique instance of the ValidationMessages class.
ValidationMessages
 Inherited
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
Protected Methods
 MethodDefined by
 Inherited
addBundle(locale:String, properties:XML, defaultBundle:Boolean = false):void
Add XML resources properties for the given locale.
InternalBundle
Public Constants
 ConstantDefined by
  NAME : String = "ValidationMessages"
[static] A constant defining the name of the validation resource bundle.
ValidationMessages
Method detail
getInstance()method
public static function getInstance():ValidationMessages

Returns a unique instance of the ValidationMessages class.

Returns
ValidationMessages — a unique instance of the ValidationMessages class.
Constant detail
NAMEconstant
public static const NAME:String = "ValidationMessages"

A constant defining the name of the validation resource bundle.