public class BundleLoader
extends java.lang.Object
ResourceBundle.getBundle(String,Locale,ClassLoader)
gives precise details. Many of these are speculative - the fetch frequently fails - and this imposes a significant overhead for any resource bundle fetch. For example, it is unusual for translations specific to American and British English to exist so there are rarely bundles suffixed with 'en_US' or 'en_GB'. In fact often 'en' does not exist as the base resource is English. For a large number of resources the set of translated locales is a given. The BundleLoader
takes advantage of this knowledge to minimise speculative searches for the default locale. Setting the System property oracle.translated.locales
to a comma separated list of locales, eg oracle.translated.locales=ja,fr_CA
, specifies the available translations. The BundleLoader
uses this list to determine which extant locale should be used as the default.Constructor and Description |
---|
BundleLoader(java.util.Locale locale, java.lang.String inclusionList)
Constructs a
BundleLoader that maps locale to a restricted one given the inclusionList . |
Modifier and Type | Method and Description |
---|---|
static java.util.ResourceBundle |
getBundle(java.lang.String baseName)
Deprecated.
Although this method will use the caller's classloader, it is using some slightly dubious reflection code to achieve this. So instead clients should use
getBundle(String,ClassLoader) . |
static java.util.ResourceBundle |
getBundle(java.lang.String baseName, java.lang.ClassLoader loader)
Gets a resource bundle using the 'default' locale and the supplied class loader.
|
public BundleLoader(java.util.Locale locale, java.lang.String inclusionList)
BundleLoader
that maps locale
to a restricted one given the inclusionList
.locale
- locale to map, must not be nullinclusionList
- comma separated list of available locales or null for no restrictionspublic static final java.util.ResourceBundle getBundle(java.lang.String baseName)
getBundle(String,ClassLoader)
.ResourceBundle.getBundle(String)
public static final java.util.ResourceBundle getBundle(java.lang.String baseName, java.lang.ClassLoader loader)
ResourceBundle.getBundle(String,Locale,ClassLoader)