Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Adobe Flex SDK Previous
-
None
-
None
-
Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Language Found: English
Description
The ResourceManager supports a locale chain, automatically getting resources from the first locale in the chain, and walking up the chain if it doesn't find the requested resource.
However, there are cases where an application may need to get a resource for a specific locale rather than for the first locale in the chain. For example, an application may resource locale-specific formatting data in different (locale-specific) resource bundles; yet, the selection of such data at run-time is likely to be independent from the selection of the user interface (it may depend on downloaded user data, etc.).
Currently, it may be possible to call method 'getResourceBundle( locale , bundleName )' and then use a get method of the returned bundle. However, it's neither clean ('getResourceBundle()' returns an 'IResourceBundle' instance, and that interface class does not have any methods to get resources; thus, the caller must know the correct type and cast) nor consistent (the get methods of class 'ResourceBundle' are considered deprecated and users are encouraged to use methods of the 'ResourceManager' class instead.
Thus, a better approach is to enhance the get methods of the 'ResourceManager' class, adding a 'locale' parameter (with a default value of 'null'). If the 'locale' parameter is 'null', the method should use the locale chain as currently done. Otherwise, it should get the resource specifically from the requested locale.