|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.stripes.localization.LocalizationUtility
public class LocalizationUtility
Provides simple localization utility methods that are used in multiple places in the Stripes code base.
Constructor Summary | |
---|---|
LocalizationUtility()
|
Method Summary | |
---|---|
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 |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalizationUtility()
Method Detail |
---|
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 field
public static String getErrorMessage(Locale locale, String key)
locale
- the locale in which to lookup the resourcekey
- the exact resource key to lookup
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |