| java.lang.Object java.util.ResourceBundle com.ibm.icu.util.UResourceBundle
All known Subclasses: com.ibm.icu.impl.ResourceBundleWrapper, com.ibm.icu.impl.ICUResourceBundle,
UResourceBundle | abstract public class UResourceBundle extends ResourceBundle (Code) | | 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");
author: ram |
Method Summary | |
protected static synchronized void | addToCache(ClassLoader cl, String fullName, ULocale defaultLocale, UResourceBundle b) | abstract protected String | getBaseName() | public static UResourceBundle | getBundleInstance(String baseName, String localeName) Creates a resource bundle using the specified base name and locale. | public static UResourceBundle | getBundleInstance(String baseName, String localeName, ClassLoader root) Creates a resource bundle using the specified base name, locale, and class root. | protected static UResourceBundle | getBundleInstance(String baseName, String localeName, ClassLoader root, boolean disableFallback) Creates a resource bundle using the specified base name, locale, and class root.
Parameters: baseName - the base name of the resource bundle, a fully qualified class name Parameters: localeName - the locale for which a resource bundle is desired Parameters: root - the class object from which to load the resource bundle Parameters: disableFallback - Option to disable locale inheritence. | public static UResourceBundle | getBundleInstance(ULocale locale) Creates a UResourceBundle for the locale specified, from which users can extract resources by using
their corresponding keys.
Parameters: 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(String baseName) Creates a UResourceBundle for the default locale and specified base name,
from which users can extract resources by using their corresponding keys.
Parameters: 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(String baseName, Locale locale) Creates a UResourceBundle for the specified locale and specified base name,
from which users can extract resources by using their corresponding keys.
Parameters: 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(String baseName, ULocale locale) Creates a UResourceBundle, from which users can extract resources by using
their corresponding keys.
Parameters: baseName - string containing the name of the data package.If null the default ICU package name is used. Parameters: 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(String baseName, Locale locale, ClassLoader loader) Creates a UResourceBundle for the specified locale and specified base name,
from which users can extract resources by using their corresponding keys.
Parameters: 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(String baseName, ULocale locale, ClassLoader loader) Creates a UResourceBundle, from which users can extract resources by using
their corresponding keys. | public Locale | getLocale() | abstract protected String | getLocaleID() | abstract protected UResourceBundle | getParent() | abstract public ULocale | getULocale() Returns the RFC 3066 conformant locale id of this resource bundle. | protected static synchronized UResourceBundle | instantiateBundle(String baseName, String localeName, ClassLoader root, boolean disableFallback) Loads a new resource bundle for the give base name, locale and class loader. | protected static synchronized UResourceBundle | loadFromCache(ClassLoader cl, String fullName, ULocale defaultLocale) | abstract protected void | setLoadingStatus(int newStatus) |
UResourceBundle | public UResourceBundle()(Code) | | Sole constructor. (For invocation by subclass constructors, typically
implicit.) This is public for compatibility with Java, whose compiler
will generate public default constructors for an abstract class.
|
getBaseName | abstract protected String getBaseName()(Code) | | Gets the base name of the resource bundle
The string representation of the base name |
getBundleInstance | public static UResourceBundle getBundleInstance(String baseName, String localeName)(Code) | | Creates a resource bundle using the specified base name and locale.
ICU_DATA_CLASS is used as the default root.
Parameters: baseName - the base name of the resource bundle, a fully qualified class name Parameters: localeName - the locale for which a resource bundle is desired exception: MissingResourceException - if no resource bundle for the specified base name can be found a resource bundle for the given base name and locale |
getBundleInstance | public static UResourceBundle getBundleInstance(String baseName, String localeName, ClassLoader root)(Code) | | Creates a resource bundle using the specified base name, locale, and class root.
Parameters: baseName - the base name of the resource bundle, a fully qualified class name Parameters: localeName - the locale for which a resource bundle is desired Parameters: root - the class object from which to load the resource bundle exception: MissingResourceException - if no resource bundle for the specified base name can be found a resource bundle for the given base name and locale |
getBundleInstance | protected static UResourceBundle getBundleInstance(String baseName, String localeName, ClassLoader root, boolean disableFallback)(Code) | | Creates a resource bundle using the specified base name, locale, and class root.
Parameters: baseName - the base name of the resource bundle, a fully qualified class name Parameters: localeName - the locale for which a resource bundle is desired Parameters: root - the class object from which to load the resource bundle Parameters: disableFallback - Option to disable locale inheritence. If true the fallback chain will not be built. exception: MissingResourceException - if no resource bundle for the specified base name can be found a resource bundle for the given base name and locale |
getBundleInstance | public static UResourceBundle getBundleInstance(ULocale locale)(Code) | | Creates a UResourceBundle for the locale specified, from which users can extract resources by using
their corresponding keys.
Parameters: locale - specifies the locale for which we want to open the resource.If null the bundle for default locale is opened. a resource bundle for the given locale |
getBundleInstance | public static UResourceBundle getBundleInstance(String baseName)(Code) | | Creates a UResourceBundle for the default locale and specified base name,
from which users can extract resources by using their corresponding keys.
Parameters: baseName - specifies the locale for which we want to open the resource.If null the bundle for default locale is opened. a resource bundle for the given base name and default locale |
getBundleInstance | public static UResourceBundle getBundleInstance(String baseName, Locale locale)(Code) | | Creates a UResourceBundle for the specified locale and specified base name,
from which users can extract resources by using their corresponding keys.
Parameters: baseName - specifies the locale for which we want to open the resource.If null the bundle for default locale is opened. Parameters: locale - specifies the locale for which we want to open the resource.If null the bundle for default locale is opened. a resource bundle for the given base name and locale |
getBundleInstance | public static UResourceBundle getBundleInstance(String baseName, ULocale locale)(Code) | | Creates a UResourceBundle, from which users can extract resources by using
their corresponding keys.
Parameters: baseName - string containing the name of the data package.If null the default ICU package name is used. Parameters: locale - specifies the locale for which we want to open the resource.If null the bundle for default locale is opened. a resource bundle for the given base name and locale |
getBundleInstance | public static UResourceBundle getBundleInstance(String baseName, Locale locale, ClassLoader loader)(Code) | | Creates a UResourceBundle for the specified locale and specified base name,
from which users can extract resources by using their corresponding keys.
Parameters: baseName - specifies the locale for which we want to open the resource.If null the bundle for default locale is opened. Parameters: locale - specifies the locale for which we want to open the resource.If null the bundle for default locale is opened. Parameters: loader - the loader to use a resource bundle for the given base name and locale |
getBundleInstance | public static UResourceBundle getBundleInstance(String baseName, ULocale locale, ClassLoader loader)(Code) | | Creates a UResourceBundle, from which users can extract resources by using
their corresponding keys.
Parameters: baseName - string containing the name of the data package.If null the default ICU package name is used. Parameters: locale - specifies the locale for which we want to open the resource.If null the bundle for default locale is opened. Parameters: loader - the loader to use a resource bundle for the given base name and locale |
getLocale | public Locale getLocale()(Code) | | Get the locale of this bundle
the locale of this resource bundle |
getLocaleID | abstract protected String getLocaleID()(Code) | | Gets the localeID
The string representation of the localeID |
getULocale | abstract public ULocale getULocale()(Code) | | Returns the RFC 3066 conformant locale id of this resource bundle.
This method can be used after a call to getBundleInstance() to
determine whether the resource bundle returned really
corresponds to the requested locale or is a fallback.
the locale of this resource bundle |
instantiateBundle | protected static synchronized UResourceBundle instantiateBundle(String baseName, String localeName, ClassLoader root, boolean disableFallback)(Code) | | Loads a new resource bundle for the give base name, locale and class loader.
Optionally will disable loading of fallback bundles.
Parameters: baseName - the base name of the resource bundle, a fully qualified class name Parameters: localeName - the locale for which a resource bundle is desired Parameters: root - the class object from which to load the resource bundle Parameters: disableFallback - disables loading of fallback lookup chain exception: MissingResourceException - if no resource bundle for the specified base name can be found a resource bundle for the given base name and locale |
setLoadingStatus | abstract protected void setLoadingStatus(int newStatus)(Code) | | |
|
|