Interface LocalizedTextProvider
- All Superinterfaces:
- Serializable
- All Known Implementing Classes:
- GlobalLocalizedTextProvider,- StrutsLocalizedTextProvider
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddDefaultResourceBundle(String bundleName) Adds the bundle to the internal list of default bundles.findDefaultText(String textKey, Locale locale) Returns a localized message for the specified key, aTextName.findDefaultText(String textKey, Locale locale, Object[] params) Returns a localized message for the specified key, aTextName, substituting variables from the array of params into the message.findResourceBundle(String bundleName, Locale locale) Finds the given resource bundle by it's name.CallsfindText(Class startClazz, String textKey, Locale locale, String defaultMessage, Object[] args)with textKey as the default message.Finds a localized text message for the given key, textKey.findText(Class<?> startClazz, String textKey, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack) Finds a localized text message for the given key, textKey.findText(ResourceBundle bundle, String textKey, Locale locale) Finds a localized text message for the given key, aTextName, in the specified resource bundle with aTextName as the default message.findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args) Finds a localized text message for the given key, aTextName, in the specified resource bundle.findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack) Finds a localized text message for the given key, aTextName, in the specified resource bundle.
- 
Method Details- 
findDefaultTextReturns a localized message for the specified key, aTextName. Neither the key nor the message is evaluated.- Parameters:
- textKey- the message key
- locale- the locale the message should be for
- Returns:
- a localized message based on the specified key, or null if no localized message can be found for it
 
- 
findDefaultTextReturns a localized message for the specified key, aTextName, substituting variables from the array of params into the message. Neither the key nor the message is evaluated.- Parameters:
- textKey- the message key
- locale- the locale the message should be for
- params- an array of objects to be substituted into the message text
- Returns:
- A formatted message based on the specified key, or null if no localized message can be found for it
 
- 
findResourceBundleFinds the given resource bundle by it's name.Will use Thread.currentThread().getContextClassLoader()as the classloader.- Parameters:
- bundleName- the name of the bundle (usually it's FQN classname).
- locale- the locale.
- Returns:
- the bundle, null if not found.
 
- 
findTextCallsfindText(Class startClazz, String textKey, Locale locale, String defaultMessage, Object[] args)with textKey as the default message.- Parameters:
- startClazz- class name
- textKey- text name
- locale- the locale
- Returns:
- the localized text, or null if none can be found and no defaultMessage is provided
- See Also:
 
- 
findTextString findText(Class<?> startClazz, String textKey, Locale locale, String defaultMessage, Object[] args) Finds a localized text message for the given key, textKey. Both the key and the message itself is evaluated as required. The following algorithm is used to find the requested message:- Look for the message in the default resource bundles.
- If not found, return defaultMessage
 When looking for the message, if the key indexes a collection (e.g. user.phone[0]) and a message for that specific key cannot be found, the general form will also be looked up (i.e. user.phone[*]). If a message is found, it will also be interpolated. Anything within ${...}will be treated as an OGNL expression and evaluated as such.- Parameters:
- startClazz- the class whose name to use as the start point for the search
- textKey- the key to find the text message for
- locale- the locale the message should be for
- defaultMessage- the message to be returned if no text message can be found in any resource bundle
- args- arguments resource bundle
- Returns:
- the localized text, or null if none can be found and no defaultMessage is provided
 
- 
findTextString findText(Class<?> startClazz, String textKey, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack) Finds a localized text message for the given key, textKey. Both the key and the message itself is evaluated as required. The following algorithm is used to find the requested message:- Look for the message in the default resource bundles.
- If not found, return defaultMessage
 When looking for the message, if the key indexes a collection (e.g. user.phone[0]) and a message for that specific key cannot be found, the general form will also be looked up (i.e. user.phone[*]). If a message is found, it will also be interpolated. Anything within ${...}will be treated as an OGNL expression and evaluated as such.If a message is not found a DEBUG level log warning will be logged. - Parameters:
- startClazz- the class whose name to use as the start point for the search
- textKey- the key to find the text message for
- locale- the locale the message should be for
- defaultMessage- the message to be returned if no text message can be found in any resource bundle
- args- arguments
- valueStack- the value stack to use to evaluate expressions instead of the one in the ActionContext ThreadLocal
- Returns:
- the localized text, or null if none can be found and no defaultMessage is provided
 
- 
findTextFinds a localized text message for the given key, aTextName, in the specified resource bundle with aTextName as the default message.If a message is found, it will also be interpolated. Anything within ${...}will be treated as an OGNL expression and evaluated as such.- Parameters:
- bundle- a resource bundle name
- textKey- text name
- locale- the locale
- Returns:
- the localized text, or null if none can be found and no defaultMessage is provided
- See Also:
 
- 
findTextString findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args) Finds a localized text message for the given key, aTextName, in the specified resource bundle.If a message is found, it will also be interpolated. Anything within ${...}will be treated as an OGNL expression and evaluated as such.If a message is not found a WARN log will be logged. - Parameters:
- bundle- the bundle
- textKey- the key
- locale- the locale
- defaultMessage- the default message to use if no message was found in the bundle
- args- arguments for the message formatter.
- Returns:
- the localized text, or null if none can be found and no defaultMessage is provided
 
- 
findTextString findText(ResourceBundle bundle, String textKey, Locale locale, String defaultMessage, Object[] args, ValueStack valueStack) Finds a localized text message for the given key, aTextName, in the specified resource bundle.If a message is found, it will also be interpolated. Anything within ${...}will be treated as an OGNL expression and evaluated as such.If a message is not found a WARN log will be logged. - Parameters:
- bundle- the bundle
- textKey- the key
- locale- the locale
- defaultMessage- the default message to use if no message was found in the bundle
- args- arguments for the message formatter.
- valueStack- the OGNL value stack.
- Returns:
- the localized text, or null if none can be found and no defaultMessage is provided
 
- 
addDefaultResourceBundleAdds the bundle to the internal list of default bundles. If the bundle already exists in the list it will be re-added.- Parameters:
- bundleName- the name of the bundle to add.
 
 
-