Packagecom.adobe.xmp.utils
Classpublic class ZStringManager

Provides a parser that converts ZString formatted strings into ActionScript properties and stores the results in a resource bundle. The locale is set during initialization of the File Info dialog, before any other calls are made to this object.

Algorithm:

Usage:

  1. Call ZStringManager.setLocale("en_US").
  2. Call ZStringManager.addZStrings(file). The file is a string containing a complete ZString-file. This call can be repeated; the ZStrings are accumulated; if there are duplications, the last one is used.
  3. Call ZStringManager.getString(key) for every item to localize. If a match is not found, the key is returned.



Public Methods
 MethodDefined by
  
addString(key:String, value:String):void
[static] Adds a ZString key-value pair to the dictionary for the current locale.
ZStringManager
  
addZStrings(file:String, bundleInfo:String = null):void
[static] Parses a translation dictionary file and makes the ZStrings available to the File Info dialog.
ZStringManager
  
contains(key:String):Boolean
[static] Reports whether a key is contained in the translation dictionaries available to the File Info dialog.
ZStringManager
  
getDictionaryFrom(key:String, sort:Boolean = false, caseSensitive:Boolean = false, descending:Boolean = false):ArrayCollection
[static] Handles special ZStrings that descibe a list of label-data pairs for the drop-down list of a combo box.
ZStringManager
  
getLocale():String
[static] Retreives the current locale
ZStringManager
  
getString(key:String, parameters:Array = null):String
[static] Main localization method, returns a translated display string.
ZStringManager
  
isZString(str:String):Boolean
[static] Reports whether a string is a valid ZString.
ZStringManager
Public Constants
 ConstantDefined by
  DEFAULT_LOCALE : String = "en_US"
[static] The default locale
ZStringManager
Method detail
addString()method
public static function addString(key:String, value:String):void

Adds a ZString key-value pair to the dictionary for the current locale.

Parameters
key:String — The new ZString key.
 
value:String — The new ZString value.
addZStrings()method 
public static function addZStrings(file:String, bundleInfo:String = null):void

Parses a translation dictionary file and makes the ZStrings available to the File Info dialog.

Parameters
file:String — The translation dictionary file.
 
bundleInfo:String (default = null) — Optional, for internal use.
contains()method 
public static function contains(key:String):Boolean

Reports whether a key is contained in the translation dictionaries available to the File Info dialog. Default values included in the key are ignored.

Parameters
key:String — The ZString key.

Returns
Boolean — True if the key is available.
getDictionaryFrom()method 
public static function getDictionaryFrom(key:String, sort:Boolean = false, caseSensitive:Boolean = false, descending:Boolean = false):ArrayCollection

Handles special ZStrings that descibe a list of label-data pairs for the drop-down list of a combo box. This method provides compatability with CS3 strings, and must be used only to fill combo box values.

Parameters
key:String — The ZString key.
 
sort:Boolean (default = false) — Sort uppercase letters first.
 
caseSensitive:Boolean (default = false) — Sort descending, while ascending is default.
 
descending:Boolean (default = false)

Returns
ArrayCollection — An array of translated strings.
getLocale()method 
public static function getLocale():String

Retreives the current locale

Returns
String — The current locale code, or "x-default" if no locale has been explicitly set.
getString()method 
public static function getString(key:String, parameters:Array = null):String

Main localization method, returns a translated display string.

Parameters
key:String — The ZString key value.
 
parameters:Array (default = null) — Optional, an array of 1-9 values with which to replace variables ^1-^9 in the retrieved string.

Returns
String — The translated string (the value matching the key in the dictionary for the current locale), or if no match is found, the display-string portion of the ZString itself, with supplied parameter values substituted for variables.

Example
 ZStringManager.getString('$$$/AWS/FileInfoLib/Dialog/MultiFileEdit=Multiple files are currently selected')

isZString()method 
public static function isZString(str:String):Boolean

Reports whether a string is a valid ZString.

Parameters
str:String — The string.

Returns
Boolean — True if the string is a valid ZString.
Constant detail
DEFAULT_LOCALEconstant
public static const DEFAULT_LOCALE:String = "en_US"

The default locale