public class LocalizationUtility
extends java.lang.Object
| Constructor and Description |
|---|
LocalizationUtility() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getErrorMessage(java.util.Locale locale,
java.lang.String key)
Looks up the specified key in the error message resource bundle.
|
static java.lang.String |
getLocalizedFieldName(java.lang.String fieldName,
java.lang.String actionPath,
java.lang.Class<? extends ActionBean> beanclass,
java.util.Locale locale)
Fetches the localized name for a form field if one exists in the form field resource bundle.
|
static java.lang.String |
makePseudoFriendlyName(java.lang.String fieldNameKey)
Makes a half hearted attempt to convert the property name of a field into a human
friendly name by breaking it on periods and upper case letters and capitalizing each word.
|
public static java.lang.String getLocalizedFieldName(java.lang.String fieldName,
java.lang.String actionPath,
java.lang.Class<? extends ActionBean> beanclass,
java.util.Locale locale)
Fetches the localized name for a form field if one exists in the form field resource bundle. If for any reason a localized value cannot be found (e.g. the bundle cannot be found, or does not contain the required properties) then null will be returned.
Looks first for a property called beanClassFQN.fieldName in the resource bundle.
If that is undefined, it next looks for actionPath.fieldName and
if not defined, looks for a property called fieldName. Will strip any indexing
from the field name prior to using it to construct property names (e.g. foo[12] will become
simply foo).
fieldName - The name of the field whose localized name to look upactionPath - The action path of the form in which the field is nested. If for some
reason this is not available, null may be passed without causing errors.locale - The desired locale of the looked up name.public static java.lang.String makePseudoFriendlyName(java.lang.String fieldNameKey)
fieldNameKey - the programmatic name of a form fieldpublic static java.lang.String getErrorMessage(java.util.Locale locale,
java.lang.String key)
locale - the locale in which to lookup the resourcekey - the exact resource key to lookup? Copyright 2005-2006, Stripes Development Team.