|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.ResourceBundle
com.ibm.icu.util.UResourceBundle
A class representing a collection of resource information pertaining to a given locale. A resource bundle provides a way of accessing locale- specfic information in a data file. You create a resource bundle that manages the resources for a given locale and then ask it for individual resources.
In ResourceBundle class, an object is created and the sub items are fetched using getString, getObject methods. In UResourceBundle,each individual element of a resource is a resource by itself.
Resource bundles in ICU are currently defined using text files which conform to the following BNF definition. More on resource bundle concepts and syntax can be found in the Users Guide.
The packaging of ICU *.res files can be of two types
ICU4C:
root.res
|
--------
| |
fr.res en.res
|
--------
| |
fr_CA.res fr_FR.res
JAVA/JDK:
LocaleElements.res
|
-------------------
| |
LocaleElements_fr.res LocaleElements_en.res
|
---------------------------
| |
LocaleElements_fr_CA.res LocaleElements_fr_FR.res
Depending on the organization of your resources, the syntax to getBundleInstance will change.
To open ICU style organization use:
UResourceBundle bundle = UResourceBundle.getBundleInstance("com/ibm/icu/impl/data/icudt30b", "en_US");
To open Java/JDK style organization use:
UResourceBundle bundle = UResourceBundle.getBundleInstance("com.ibm.icu.impl.data.LocaleElements", "en_US");
Field Summary |
Fields inherited from class java.util.ResourceBundle |
parent |
Constructor Summary | |
UResourceBundle()
Sole constructor. |
Method Summary | |
protected static void |
addToCache(java.lang.ClassLoader cl,
java.lang.String fullName,
ULocale defaultLocale,
UResourceBundle b)
|
protected abstract java.lang.String |
getBaseName()
Gets the base name of the resource bundle |
static UResourceBundle |
getBundleInstance(java.lang.String baseName)
Creates a UResourceBundle for the default locale and specified base name, from which users can extract resources by using their corresponding keys. |
static UResourceBundle |
getBundleInstance(java.lang.String baseName,
java.util.Locale locale)
Creates a UResourceBundle for the specified locale and specified base name, from which users can extract resources by using their corresponding keys. |
static UResourceBundle |
getBundleInstance(java.lang.String baseName,
java.util.Locale locale,
java.lang.ClassLoader loader)
Creates a UResourceBundle for the specified locale and specified base name, from which users can extract resources by using their corresponding keys. |
static UResourceBundle |
getBundleInstance(java.lang.String baseName,
java.lang.String localeName)
Creates a resource bundle using the specified base name and locale. |
static UResourceBundle |
getBundleInstance(java.lang.String baseName,
java.lang.String localeName,
java.lang.ClassLoader root)
Creates a resource bundle using the specified base name, locale, and class root. |
protected static UResourceBundle |
getBundleInstance(java.lang.String baseName,
java.lang.String localeName,
java.lang.ClassLoader root,
boolean disableFallback)
Creates a resource bundle using the specified base name, locale, and class root. |
static UResourceBundle |
getBundleInstance(java.lang.String baseName,
ULocale locale)
Creates a UResourceBundle, from which users can extract resources by using their corresponding keys. |
static UResourceBundle |
getBundleInstance(java.lang.String baseName,
ULocale locale,
java.lang.ClassLoader loader)
Deprecated. This API is ICU internal only. |
static UResourceBundle |
getBundleInstance(ULocale locale)
Creates a UResourceBundle for the locale specified, from which users can extract resources by using their corresponding keys. |
java.util.Locale |
getLocale()
Get the locale of this bundle |
protected abstract java.lang.String |
getLocaleID()
Gets the localeID |
protected abstract UResourceBundle |
getParent()
Gets the parent bundle |
abstract ULocale |
getULocale()
Returns the RFC 3066 conformant locale id of this resource bundle. |
protected static UResourceBundle |
instantiateBundle(java.lang.String baseName,
java.lang.String localeName,
java.lang.ClassLoader root,
boolean disableFallback)
Loads a new resource bundle for the give base name, locale and class loader. |
protected static UResourceBundle |
loadFromCache(java.lang.ClassLoader cl,
java.lang.String fullName,
ULocale defaultLocale)
|
protected abstract void |
setLoadingStatus(int newStatus)
|
Methods inherited from class java.util.ResourceBundle |
getBundle, getBundle, getBundle, getKeys, getObject, getString, getStringArray, handleGetObject, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UResourceBundle()
Method Detail |
public static UResourceBundle getBundleInstance(java.lang.String baseName, java.lang.String localeName)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleName
- the locale for which a resource bundle is desired
java.util.MissingResourceException
- if no resource bundle for the specified base name can be foundpublic static UResourceBundle getBundleInstance(java.lang.String baseName, java.lang.String localeName, java.lang.ClassLoader root)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleName
- the locale for which a resource bundle is desiredroot
- the class object from which to load the resource bundle
java.util.MissingResourceException
- if no resource bundle for the specified base name can be foundprotected static UResourceBundle getBundleInstance(java.lang.String baseName, java.lang.String localeName, java.lang.ClassLoader root, boolean disableFallback)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleName
- the locale for which a resource bundle is desiredroot
- the class object from which to load the resource bundledisableFallback
- Option to disable locale inheritence.
If true the fallback chain will not be built.
java.util.MissingResourceException
- if no resource bundle for the specified base name can be foundpublic static UResourceBundle getBundleInstance(ULocale locale)
locale
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.
public static UResourceBundle getBundleInstance(java.lang.String baseName)
baseName
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.
public static UResourceBundle getBundleInstance(java.lang.String baseName, java.util.Locale locale)
baseName
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.locale
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.
public static UResourceBundle getBundleInstance(java.lang.String baseName, ULocale locale)
baseName
- string containing the name of the data package.
If null the default ICU package name is used.locale
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.
public static UResourceBundle getBundleInstance(java.lang.String baseName, java.util.Locale locale, java.lang.ClassLoader loader)
baseName
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.locale
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.loader
- the loader to use
public static UResourceBundle getBundleInstance(java.lang.String baseName, ULocale locale, java.lang.ClassLoader loader)
baseName
- string containing the name of the data package.
If null the default ICU package name is used.locale
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.loader
- the loader to use
public abstract ULocale getULocale()
protected abstract java.lang.String getLocaleID()
protected abstract java.lang.String getBaseName()
protected abstract UResourceBundle getParent()
public java.util.Locale getLocale()
protected static void addToCache(java.lang.ClassLoader cl, java.lang.String fullName, ULocale defaultLocale, UResourceBundle b)
protected static UResourceBundle loadFromCache(java.lang.ClassLoader cl, java.lang.String fullName, ULocale defaultLocale)
protected static UResourceBundle instantiateBundle(java.lang.String baseName, java.lang.String localeName, java.lang.ClassLoader root, boolean disableFallback)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleName
- the locale for which a resource bundle is desiredroot
- the class object from which to load the resource bundledisableFallback
- disables loading of fallback lookup chain
java.util.MissingResourceException
- if no resource bundle for the specified base name can be foundprotected abstract void setLoadingStatus(int newStatus)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |