public class LocalizationUtility extends Object
| Constructor and Description |
|---|
LocalizationUtility() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getErrorMessage(Locale locale,
String key)
Looks up the specified key in the error message resource bundle.
|
static String |
getLocalizedFieldName(String fieldName,
String actionPath,
Class<? extends ActionBean> beanclass,
Locale locale)
Fetches the localized name for a form field if one exists in the form field resource bundle.
|
static String |
getSimpleName(Class<?> c)
Gets the simple name of a class for use as a key to look up a resource.
|
static String |
makePseudoFriendlyName(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 String getLocalizedFieldName(String fieldName, String actionPath, Class<? extends ActionBean> beanclass, 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 String makePseudoFriendlyName(String fieldNameKey)
fieldNameKey - the programmatic name of a form fieldpublic static String getErrorMessage(Locale locale, String key)
locale - the locale in which to lookup the resourcekey - the exact resource key to lookuppublic static String getSimpleName(Class<?> c)
Class.getSimpleName(), but static inner classes are handled such that the
simple name is OuterClass.InnerClass. Multiple layers of nesting are supported.c - The class whose simple name is requested.© Copyright 2005-2006, Stripes Development Team.