PropertyResourceBundle | API reference | Android Developers
From class ResourceBundle
Unit |
clearCache()
Removes all resource bundles from the cache that have been loaded using the caller's class loader. |
|||||||||||||||||||||
Unit |
clearCache(loader: ClassLoader!)
Removes all resource bundles from the cache that have been loaded by the given class loader. |
|||||||||||||||||||||
Boolean |
containsKey(key: String!)
Determines whether the given |
|||||||||||||||||||||
String! |
getBaseBundleName()
Returns the base name of this bundle, if known, or |
|||||||||||||||||||||
ResourceBundle! |
getBundle(baseName: String!)
Gets a resource bundle using the specified base name, the default locale, and the caller's class loader. Calling this method is equivalent to calling |
|||||||||||||||||||||
ResourceBundle! |
getBundle(baseName: String!, locale: Locale!)
Gets a resource bundle using the specified base name and locale, and the caller's class loader. Calling this method is equivalent to calling |
|||||||||||||||||||||
ResourceBundle! |
getBundle(baseName: String!, locale: Locale!, loader: ClassLoader!)
Gets a resource bundle using the specified base name, locale, and class loader. This is equivalent to calling: getBundle(baseName, targetLocale, loader, control)passing a default instance of Control. Refer to the description of modifying the default behavior. The following describes the default behavior.
Resource Bundle Search and Loading Strategy
baseName + "_" + language + "_" + script + "_" + country + "_" + variant baseName + "_" + language + "_" + script + "_" + country baseName + "_" + language + "_" + script baseName + "_" + language + "_" + country + "_" + variant baseName + "_" + language + "_" + country baseName + "_" + language Candidate bundle names where the final component is an empty string are omitted, along with the underscore. For example, if country is an empty string, the second and the fifth candidate bundle names above would be omitted. Also, if script is an empty string, the candidate names including script are omitted. For example, a locale with language "de" and variant "JAVA" will produce candidate names with base name "MyResource" below. MyResource_de__JAVA MyResource_deIn the case that the variant contains one or more underscores ('_'), a sequence of bundle names generated by truncating the last underscore and the part following it is inserted after a candidate bundle name with the original variant. For example, for a locale with language "en", script "Latn, country "US" and variant "WINDOWS_VISTA", and bundle base name "MyResource", the list of candidate bundle names below is generated: MyResource_en_Latn_US_WINDOWS_VISTA MyResource_en_Latn_US_WINDOWS MyResource_en_Latn_US MyResource_en_Latn MyResource_en_US_WINDOWS_VISTA MyResource_en_US_WINDOWS MyResource_en_US MyResource_enNote: For some Locales, the list of candidate bundle names contains extra names, or the order of bundle names is slightly modified. See the description of the default implementation of getCandidateLocales for details.
This continues until a result resource bundle is instantiated or the list of candidate bundle names is exhausted. If no matching resource bundle is found, the default control's If still no result bundle is found, the base name alone is looked up. If this still fails, a Once a result resource bundle has been found, its parent chain is instantiated. If the result bundle already has a parent (perhaps because it was returned from a cache) the chain is complete. Otherwise, Whenever it succeeds, it calls the previously instantiated resource bundle's Once the parent chain is complete, the bundle is returned. Note: Note:The Example: The following class and property files are provided:
ResourceBundle for the ".class" files, syntactically correct ".properties" files). The default locale is Locale("en", "GB").
Calling
The file MyResources_fr_CH.properties is never used because it is hidden by the MyResources_fr_CH.class. Likewise, MyResources.properties is also hidden by MyResources.class. |
|||||||||||||||||||||
ResourceBundle! |
getBundle(baseName: String!, targetLocale: Locale!, loader: ClassLoader!, control: ResourceBundle.Control!)
Returns a resource bundle using the specified base name, target locale, class loader and control. Unlike the
During the resource bundle loading process above, this factory method looks up the cache before calling the All resource bundles loaded are cached by default. Refer to The following is an example of the bundle loading process with the default Conditions:
First,
At this point,
|
|||||||||||||||||||||
ResourceBundle! |
getBundle(baseName: String!, targetLocale: Locale!, control: ResourceBundle.Control!)
Returns a resource bundle using the specified base name, target locale and control, and the caller's class loader. Calling this method is equivalent to calling getBundle(baseName, targetLocale, this.getClass().getClassLoader(), control),except that getClassLoader() is run with the security privileges of ResourceBundle. See getBundle for the complete description of the resource bundle loading process with a ResourceBundle.Control.
|
|||||||||||||||||||||
ResourceBundle! |
getBundle(baseName: String!, control: ResourceBundle.Control!)
Returns a resource bundle using the specified base name, the default locale and the specified control. Calling this method is equivalent to calling getBundle(baseName, Locale.getDefault(), this.getClass().getClassLoader(), control),except that getClassLoader() is run with the security privileges of ResourceBundle. See getBundle for the complete description of the resource bundle loading process with a ResourceBundle.Control.
|
|||||||||||||||||||||
Locale! |
getLocale()
Returns the locale of this resource bundle. This method can be used after a call to getBundle() to determine whether the resource bundle returned really corresponds to the requested locale or is a fallback. |
|||||||||||||||||||||
Any! |
getObject(key: String!)
Gets an object for the given key from this resource bundle or one of its parents. This method first tries to obtain the object from this resource bundle using |
|||||||||||||||||||||
String! |
getString(key: String!)
Gets a string for the given key from this resource bundle or one of its parents. Calling this method is equivalent to calling |
|||||||||||||||||||||
Array<String!>! |
getStringArray(key: String!)
Gets a string array for the given key from this resource bundle or one of its parents. Calling this method is equivalent to calling |
|||||||||||||||||||||
MutableSet<String!>! |
keySet()
Returns a |
|||||||||||||||||||||
Unit |
setParent(parent: ResourceBundle!)
Sets the parent bundle of this bundle. The parent bundle is searched by |