|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.tools.struts.MessageResourcesTool org.apache.velocity.tools.struts.MessageTool
View tool that provides methods to render Struts application resources for internationalized text.
Template example(s): #if( $text.exists('greeting') ) $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.
Field Summary |
Fields inherited from class org.apache.velocity.tools.struts.MessageResourcesTool |
application, locale, request, resources |
Constructor Summary | |
MessageTool()
Default constructor. |
Method Summary | |
boolean |
exists(java.lang.String key)
Checks if a message string for a specified message key exists for the user's locale. |
boolean |
exists(java.lang.String key,
java.lang.String bundle)
Checks if a message string for a specified message key exists for the user's locale. |
java.lang.String |
get(java.lang.String key)
Looks up and returns the localized message for the specified key. |
java.lang.String |
get(java.lang.String key,
java.util.List args)
Same as get(String key, Object[] args) , but takes a
java.util.List instead of an array. |
java.lang.String |
get(java.lang.String key,
java.lang.Object[] args)
Looks up and returns the localized message for the specified key. |
java.lang.String |
get(java.lang.String key,
java.lang.String bundle)
Looks up and returns the localized message for the specified key. |
java.lang.String |
get(java.lang.String key,
java.lang.String bundle,
java.util.List args)
Same as get(String key, Object[] args) , but takes a
java.util.List instead of an array. |
java.lang.String |
get(java.lang.String key,
java.lang.String bundle,
java.lang.Object[] args)
Looks up and returns the localized message for the specified key. |
java.util.Locale |
getLocale()
Deprecated. This does not fit the purpose of MessageTool and will be removed in VelocityTools 1.2 |
Methods inherited from class org.apache.velocity.tools.struts.MessageResourcesTool |
getResources, init |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MessageTool()
Method Detail |
public java.lang.String get(java.lang.String key)
key
- message key
null
if no such message existspublic java.lang.String get(java.lang.String key, java.lang.String bundle)
key
- message keybundle
- The bundle name to look for.
null
if no such message existspublic java.lang.String get(java.lang.String key, java.lang.Object[] args)
args
are
inserted into the message. The user's locale is consulted to
determine the language of the message.
key
- message keyargs
- replacement parameters for this message
null
if no such message existspublic java.lang.String get(java.lang.String key, java.lang.String bundle, java.lang.Object[] args)
args
are
inserted into the message. The user's locale is consulted to
determine the language of the message.
key
- message keybundle
- The bundle name to look for.args
- replacement parameters for this message
null
if no such message existspublic java.lang.String get(java.lang.String key, java.util.List args)
get(String key, Object[] args)
, but takes a
java.util.List
instead of an array. This is more
Velocity friendly.
key
- message keyargs
- replacement parameters for this message
null
if no such message existspublic java.lang.String get(java.lang.String key, java.lang.String bundle, java.util.List args)
get(String key, Object[] args)
, but takes a
java.util.List
instead of an array. This is more
Velocity friendly.
key
- message keybundle
- The bundle name to look for.args
- replacement parameters for this message
null
if no such message existspublic boolean exists(java.lang.String key)
key
- message key
true
if a message strings exists,
false
otherwisepublic boolean exists(java.lang.String key, java.lang.String bundle)
key
- message keybundle
- The bundle name to look for.
true
if a message strings exists,
false
otherwisepublic java.util.Locale getLocale()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |