Class OraResourceBundle
- java.lang.Object
-
- oracle.i18n.util.OraResourceBundle
-
public class OraResourceBundle extends Object
TheOraResourceBundleclass is the factory class that constructs ajava.util.ResourceBundleinstance.This class provides the special locale fallback behaviors on top of the Java behaviors. The rules follow:
- If the given locale exactly matches the locale in the available resource bundles, it will be used.
-
If the resource bundle for Chinese in Singapore (
zh_SG) is not found, it will fallback to the resource bundle for Chinese in China (zh_CN) for Simplified Chinese translations. -
If the resource bundle for Chinese in Hong Kong (
zh_HK) is not found, it will fallback to the resource bundle for Chinese in Taiwan (zh_TW) for Traditional Chinese translations. -
If the resource bundle for Chinese in Macau (
zh_MO) is not found, it will fallback to the resource bundle for Chinese in Taiwan (zh_TW) for Traditional Chinese translations. -
If the resource bundles for any other Chinese locale (
zh_andzh) is not found, it will fallback to the resource bundle for Chinese in China (zh_CN) for Simplified Chinese translations. -
The default locale, which can be obtained by the
Locale.getDefault()method, will not be considered in the fallback operations.
For example, assume the default locale is
ja_JPand the resource bundle for it is available. When the resource bundle fores_MXis requested and neither resource bundle foresores_MXis provided, the base resource bundle object that does not have a local suffix is returned.The usage of the
OraResourceBundleclass is similar to thejava.util.ResourceBundleclass, but theOraResourceBundleclass does not instantiate itself. Instead, the return value of thegetBundlemethod is an instance of the subclass of thejava.util.ResourceBundleclass. The following is an example showing how to get the instance of the bundle:import java.util.ResourceBundle; import oracle.i18n.util.OraResourceBundle; ... ResourceBundle resb = OraResourceBundle.getBundle( "oracle.demo.wob.Translations", request.getLocale()); ... String resb = resb.getString("hello"); ...- Since:
- 10.1.0.2
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ResourceBundlegetBundle(String baseName)Deprecated.As of Oracle Database 10g Release 2 (10.2), replaced bygetBundle(String, Locale)static ResourceBundlegetBundle(String baseName, Locale locale)Returns aResourceBundleobject specified by the base class name.static ResourceBundlegetBundle(String baseName, Locale locale, ClassLoader classLoader)Returns aResourceBundleobject specified by the base class name.
-
-
-
Method Detail
-
getBundle
public static ResourceBundle getBundle(String baseName, Locale locale, ClassLoader classLoader)
Returns aResourceBundleobject specified by the base class name. A locale should be specified to get the translations. The class loader can be specified if necessary.- Parameters:
baseName- a base name of theResourceBundleclasslocale- a locale used to specify the translation languageclassLoader- aClassLoaderobject used to load theResourceBundleclass- Returns:
- a
ResourceBundleobject
-
getBundle
public static ResourceBundle getBundle(String baseName, Locale locale)
Returns aResourceBundleobject specified by the base class name. A locale should be specified to get the translations.- Parameters:
baseName- a base name of theResourceBundleclasslocale- a locale used to specify the translation language- Returns:
- a
ResourceBundleobject
-
getBundle
public static ResourceBundle getBundle(String baseName)
Deprecated.As of Oracle Database 10g Release 2 (10.2), replaced bygetBundle(String, Locale)Returns aResourceBundleobject derived from the given base class name. By default, the translation is in English.- Parameters:
baseName- a base name of theResourceBundleclass- Returns:
- a
ResourceBundleobject
-
-