public class ResourceBundleUtils extends Object
Utility to get resource bundle from either HST ResourceBundleRegistry or Java Standard Resource Bundles or from Repository stored resource bundle files. In case of repository stored resource bundles, the bundle nodes must be of type nt:file containing jcr:content that contain Java Standard Resource Bundle files.
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTIES_SUFFIX |
static int |
PROPERTIES_SUFFIX_LENGTH |
Modifier and Type | Method and Description |
---|---|
static ResourceBundle |
getBundle(javax.servlet.http.HttpServletRequest servletRequest,
String basename,
Locale locale)
Deprecated.
since HST 2.30.00 (CMS 10.0) Use
getBundle(String, java.util.Locale) instead since servletRequest is unused |
static ResourceBundle |
getBundle(javax.servlet.http.HttpServletRequest servletRequest,
String basename,
Locale locale,
boolean fallbackToJavaResourceBundle)
Deprecated.
since HST 2.30.00 (CMS 10.0) Use
getBundle(String, java.util.Locale, boolean) instead since servletRequest is unused |
static ResourceBundle |
getBundle(javax.jcr.Session session,
String baseJcrAbsFilePath,
Locale locale) |
static ResourceBundle |
getBundle(String basename,
Locale locale)
Returns resource bundle based on the specified basename and locale.
|
static ResourceBundle |
getBundle(String basename,
Locale locale,
boolean fallbackToJavaResourceBundle)
Returns resource bundle based on the specified basename and locale.
|
static List<Locale> |
localeLookupList(Locale locale) |
public static final String PROPERTIES_SUFFIX
public static final int PROPERTIES_SUFFIX_LENGTH
@Deprecated public static ResourceBundle getBundle(javax.servlet.http.HttpServletRequest servletRequest, String basename, Locale locale)
getBundle(String, java.util.Locale)
instead since servletRequest
is unusedservletRequest
- basename
- locale
- NullPointerException
- - if baseName is nullMissingResourceException
- - if no Java standard resource bundle for the specified base name can be foundpublic static ResourceBundle getBundle(String basename, Locale locale)
basename
- locale
- NullPointerException
- - if baseName is nullMissingResourceException
- - if no Java standard resource bundle for the specified base name can be found@Deprecated public static ResourceBundle getBundle(javax.servlet.http.HttpServletRequest servletRequest, String basename, Locale locale, boolean fallbackToJavaResourceBundle)
getBundle(String, java.util.Locale, boolean)
instead since servletRequest
is unusedservletRequest
- basename
- locale
- fallbackToJavaResourceBundle
- NullPointerException
- - if baseName is nullMissingResourceException
- - if no Java standard resource bundle for the specified base name can be foundpublic static ResourceBundle getBundle(String basename, Locale locale, boolean fallbackToJavaResourceBundle)
basename
- locale
- fallbackToJavaResourceBundle
- NullPointerException
- - if baseName is nullMissingResourceException
- - if no Java standard resource bundle for the specified base name can
be foundpublic static ResourceBundle getBundle(javax.jcr.Session session, String baseJcrAbsFilePath, Locale locale)
session
- the jcr session to build the resource bundles withbaseJcrAbsFilePath
- the absolute jcr path to the base resource bundle, which must be a path starting with
a /
and ending with .properties
and most point to a jcr node
of type nt:file
locale
- the Locale
to get the resource bundle for. If null
the base resource
bundle is returnedResourceBundle
for baseJcrAbsFilePath
and locale
IllegalArgumentException
- if no resource bundle for the specified baseJcrAbsFilePath
can be found or in case baseJcrAbsFilePath
is null
IllegalStateException
- in case an exception occursCopyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.