| java.lang.Object org.apache.velocity.tools.struts.MessageResourcesTool org.apache.velocity.tools.struts.MessageTool
MessageTool | public class MessageTool extends MessageResourcesTool (Code) | | View tool that provides methods to render Struts
application resources for internationalized text.
Template example(s):
#if( $text.greeting.exists )
$text.greeting
#end
Toolbox configuration:
<tool>
<key>text</key>
<scope>request</scope>
<class>org.apache.velocity.tools.struts.MessageTool</class>
</tool>
This tool should only be used in the request scope.
author: Gabe Sidler since: VelocityTools 1.0 version: $Id: MessageTool.java 477914 2006-11-21 21:52:11Z henning $ |
Inner Class :public class TextKey | |
Constructor Summary | |
public | MessageTool() Default constructor. |
Method Summary | |
public boolean | exists(String key) Checks if a message string for a specified message key exists
for the user's locale. | public boolean | exists(String key, String bundle) Checks if a message string for a specified message key exists
for the user's locale. | public TextKey | get(String key) Looks up and returns the localized message for the specified key. | public String | get(String key, String bundle) Looks up and returns the localized message for the specified key.
The user's locale is consulted to determine the language of the
message.
Parameters: key - message key Parameters: bundle - The bundle name to look for. | public String | get(String key, Object args) Looks up and returns the localized message for the specified key.
Replacement parameters passed with args are
inserted into the message. | public String | get(String key, String bundle, Object args) Looks up and returns the localized message for the specified key.
Replacement parameters passed with args are
inserted into the message. | public String | get(String key, List args) Same as
MessageTool.get(String key,Object[] args) , but takes a
java.util.List instead of an array. | public String | get(String key, String bundle, List args) Same as
MessageTool.get(String key,Object[] args) , but takes a
java.util.List instead of an array. |
MessageTool | public MessageTool()(Code) | | Default constructor. Tool must be initialized before use.
|
exists | public boolean exists(String key)(Code) | | Checks if a message string for a specified message key exists
for the user's locale.
Parameters: key - message key true if a message strings exists,false otherwise |
exists | public boolean exists(String key, String bundle)(Code) | | Checks if a message string for a specified message key exists
for the user's locale.
Parameters: key - message key Parameters: bundle - The bundle name to look for. since: VelocityTools 1.1 true if a message strings exists,false otherwise |
get | public TextKey get(String key)(Code) | | Looks up and returns the localized message for the specified key.
The user's locale is consulted to determine the language of the
message.
Example use: $text.forms.profile.title
Parameters: key - message key |
get | public String get(String key, String bundle)(Code) | | Looks up and returns the localized message for the specified key.
The user's locale is consulted to determine the language of the
message.
Parameters: key - message key Parameters: bundle - The bundle name to look for. the localized message for the specified key ornull if no such message exists since: VelocityTools 1.1 |
get | public String get(String key, Object args)(Code) | | Looks up and returns the localized message for the specified key.
Replacement parameters passed with args are
inserted into the message. The user's locale is consulted to
determine the language of the message.
Parameters: key - message key Parameters: args - replacement parameters for this message the localized message for the specified key ornull if no such message exists |
get | public String get(String key, String bundle, Object args)(Code) | | Looks up and returns the localized message for the specified key.
Replacement parameters passed with args are
inserted into the message. The user's locale is consulted to
determine the language of the message.
Parameters: key - message key Parameters: bundle - The bundle name to look for. Parameters: args - replacement parameters for this message since: VelocityTools 1.1 the localized message for the specified key ornull if no such message exists |
get | public String get(String key, List args)(Code) | | Same as
MessageTool.get(String key,Object[] args) , but takes a
java.util.List instead of an array. This is more
Velocity friendly.
Parameters: key - message key Parameters: args - replacement parameters for this message the localized message for the specified key ornull if no such message exists |
get | public String get(String key, String bundle, List args)(Code) | | Same as
MessageTool.get(String key,Object[] args) , but takes a
java.util.List instead of an array. This is more
Velocity friendly.
Parameters: key - message key Parameters: bundle - The bundle name to look for. Parameters: args - replacement parameters for this message since: VelocityTools 1.1 the localized message for the specified key ornull if no such message exists |
|
|