|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.globalization.Globalization
Utilities for the globalization process. The methods in this class make use of the assumption that the ACS handles all locale and resource negotiation so that the application developer doesn't have to worry about it.
Field Summary | |
static String |
DEFAULT_ENCODING
The default encoding for request/response body data, as specified by the servlet spec |
static String |
DEFAULT_PARAM_ENCODING
The default encoding for parameterts, as specified by the servlet spec |
static String |
ENCODING_PARAM_NAME
|
static String |
versionId
|
Constructor Summary | |
Globalization()
|
Method Summary | |
static String |
decodeParameter(javax.servlet.http.HttpServletRequest r,
String name)
Decode the value of an HttpServletRequest parameter. |
static String[] |
decodeParameters(javax.servlet.http.HttpServletRequest r,
String name)
Decode all of the values of an HttpServletRequest array parameter. |
static ResourceBundle |
getBundleNoFallback(String targetBundle,
Locale locale,
Locale defaultLocale)
Find the ResourceBundle for this language without falling back to a default ResourceBundle in another language |
static String |
getDefaultCharset()
Get the default character set for encoding data |
static String |
getDefaultCharset(javax.servlet.http.HttpServletRequest req)
Get the default character set for the request. |
static String |
getDefaultCharset(Locale locale)
Get the default character set for a given locale. |
static Object |
getLocalizedObject(javax.servlet.http.HttpServletRequest r,
String key)
Get an Object from the appropriate ResourceBundle based on the appropriate Locale and key. |
static String |
getLocalizedString(javax.servlet.http.HttpServletRequest r,
String key)
Get a String from the appropriate ResourceBundle based on the appropriate Locale and key. |
static String |
getLocalizedString(javax.servlet.http.HttpServletRequest r,
String key,
Object[] arguments)
Get a parameterized String (for doing MessageFormatting) from the appropraite ResourceBundle based on the appropriate Locale and key. |
static ResourceBundle |
getResourceBundle()
Get the appropriate ResourceBundle based ont he request and locale. |
static ResourceBundle |
getResourceBundle(javax.servlet.http.HttpServletRequest r)
Get the appropriate ResourceBundle based on the request and Locale |
static void |
loadLocaleToCharsetMap()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
public static final String ENCODING_PARAM_NAME
public static final String DEFAULT_PARAM_ENCODING
public static final String DEFAULT_ENCODING
Constructor Detail |
public Globalization()
Method Detail |
public static void loadLocaleToCharsetMap()
public static String getDefaultCharset()
public static String getDefaultCharset(Locale locale)
Get the default character set for a given locale.
locale
-
Locale
public static String getDefaultCharset(javax.servlet.http.HttpServletRequest req)
public static final String decodeParameter(javax.servlet.http.HttpServletRequest r, String name)
Decode the value of an HttpServletRequest parameter. The value is decoded appropriately (lets hope so anyway).
r
- The HttpServletRequest for which to get the value.name
- The name of the parameter to retrieve.
public static final String[] decodeParameters(javax.servlet.http.HttpServletRequest r, String name)
Decode all of the values of an HttpServletRequest array parameter.
r
- The HttpServletRequest for which to decode the parameters.
public static ResourceBundle getResourceBundle()
Get the appropriate ResourceBundle based ont he request and locale.
ResourceBundle
public static ResourceBundle getResourceBundle(javax.servlet.http.HttpServletRequest r)
Get the appropriate ResourceBundle based on the request and Locale
r
- The current HttpServletRequest
ResourceBundle
public static Object getLocalizedObject(javax.servlet.http.HttpServletRequest r, String key)
Get an Object from the appropriate ResourceBundle based on the appropriate Locale and key.
r
- The current HttpServletRequest.key
- The key used to select the appropriate Object
ResourceBundle
public static String getLocalizedString(javax.servlet.http.HttpServletRequest r, String key)
Get a String from the appropriate ResourceBundle based on the appropriate Locale and key.
r
- The current HttpServletRequest.key
- The key used to select the appropriate String
ResourceBundle
public static String getLocalizedString(javax.servlet.http.HttpServletRequest r, String key, Object[] arguments)
Get a parameterized String (for doing MessageFormatting) from the appropraite ResourceBundle based on the appropriate Locale and key. Then interpolate the values for the other keys passed.
r
- The current HttpServletRequest.key
- The key used to select the appropriate Stringarguments
- A Object[] containing the other keys to localize and
interpolate into the parameterized string. It may also
contain other Objects beside Strings, such as Date
objects and Integers, etc.
MessageFormat
,
ResourceBundle
public static ResourceBundle getBundleNoFallback(String targetBundle, Locale locale, Locale defaultLocale)
Find the ResourceBundle for this language without falling back to a default ResourceBundle in another language
targetBundle
- The ResourceBundle we are looking for.locale
- The Locale object representing the language we want.defaultLocale
- The Locale object representing the default language.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |